def post_changed_groups(sender, instance, action, **kwargs): """ Updated UCengine roles depending on Django's groups """ rootsession = UCEngine(UCENGINE['host'], UCENGINE['port'])\ .connect(UCUser(UCENGINE['user']), credential=UCENGINE['pwd']) if action == "pre_clear" or action == "pre_remove": _delete_ucengine_roles(rootsession, instance) if action == "post_add": _add_ucengine_roles(rootsession, instance) rootsession.close()
def overwrite_ucengine_credentials(sender, **kwargs): """ override the user's UCEngine's password uses a random/unique password different from the one already in the profile sender = Signal() kwargs = {'request': Request(), 'user': User()} """ djangouser = kwargs['user'] if djangouser is not None: rootsession = UCEngine(UCENGINE['host'],\ UCENGINE['port'])\ .connect(UCUser(UCENGINE['user']),\ credential=UCENGINE['pwd']) _save_django_user(rootsession, djangouser, sync=False, created=False) rootsession.close()
def update_ucengine_credentials(sender, **kwargs): """ override the user's UCEngine's password uses a random/unique password stores it in into the user's Django's session sender = Signal() kwargs = {'request': Request(), 'user': User()} """ djangouser = kwargs['user'] if djangouser is not None: rootsession = UCEngine(UCENGINE['host'],\ UCENGINE['port'])\ .connect(UCUser(UCENGINE['user']),\ credential=UCENGINE['pwd']) _save_django_user(rootsession, djangouser, sync=True, created=False) rootsession.close()