gva/gnuviechadmin/osusers/tasks.py
Jan Dittberner 6eb74f5b79 add more ldap tasks
- add custom celery router osusers.tasks.LdapRouter
- add tasks add_ldap_user_to_group, delete_ldap_group_if_empty,
  delete_ldap_user and remove_ldap_user_from_group
- implement osusers.models.Group.save and osusers.models.Group.delete
- implement save, delete and set_password methods in osusers.models.User
- implement save and delete methods in osusers.models.AdditionalGroup
2014-05-30 17:10:22 +02:00

43 lines
747 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(group):
pass