OpenSlides/openslides/users/api.py
Norman Jäckel 3a19218bd5 Refactored parts of users app.
Refactored user creation and update via REST API. Used new serializer.
Cleaned up management commands, signals and imports. Moved code from 'api.py' to 'models.py'.
Changed usage of group 'Registered'. Now the users don't have to be members to gain its permissions. Used customized auth backend for this.
Added and changed some tests.
2015-02-14 02:29:53 +01:00

11 lines
331 B
Python

from .models import Permission
def get_protected_perm():
"""
Returns the permission to manage users. This function is a helper
function used to protect manager users from locking out themselves.
"""
return Permission.objects.get_by_natural_key(
app_label='users', model='user', codename='can_manage')