3a19218bd5
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.
11 lines
331 B
Python
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')
|