43 lines
751 B
Python
43 lines
751 B
Python
from __future__ import absolute_import
|
|
|
|
from celery import shared_task
|
|
|
|
|
|
class LdapRouter(object):
|
|
|
|
def route_for_task(self, task, args=None, kwargs=None):
|
|
if 'ldap' in task:
|
|
return {'exchange': 'ldap',
|
|
'exchange_type': 'direct',
|
|
'queue': 'ldap'}
|
|
return None
|
|
|
|
|
|
@shared_task
|
|
def create_ldap_group(group):
|
|
return group.groupname
|
|
|
|
|
|
@shared_task
|
|
def create_ldap_user(user, password):
|
|
return user.username
|
|
|
|
|
|
@shared_task
|
|
def add_ldap_user_to_group(username, groupname):
|
|
pass
|
|
|
|
|
|
@shared_task
|
|
def remove_ldap_user_from_group(username, groupname):
|
|
pass
|
|
|
|
|
|
@shared_task
|
|
def delete_ldap_user(user):
|
|
pass
|
|
|
|
|
|
@shared_task
|
|
def delete_ldap_group_if_empty(groupname):
|
|
pass
|