Tiny code refactoring
This commit is contained in:
parent
69ef7b7827
commit
3d80cc5a72
|
@ -26,8 +26,8 @@ with file.open('r') as stream:
|
||||||
Token.objects.create(user=user, key=user_details['api_token'])
|
Token.objects.create(user=user, key=user_details['api_token'])
|
||||||
|
|
||||||
yaml_permissions = user_details.get('permissions', [])
|
yaml_permissions = user_details.get('permissions', [])
|
||||||
subject = user.user_permissions
|
|
||||||
if yaml_permissions:
|
if yaml_permissions:
|
||||||
|
subject = user.user_permissions
|
||||||
subject.clear()
|
subject.clear()
|
||||||
for yaml_permission in yaml_permissions:
|
for yaml_permission in yaml_permissions:
|
||||||
if '*' in yaml_permission:
|
if '*' in yaml_permission:
|
||||||
|
|
|
@ -25,8 +25,8 @@ with file.open('r') as stream:
|
||||||
user.groups.add(group)
|
user.groups.add(group)
|
||||||
|
|
||||||
yaml_permissions = group_details.get('permissions', [])
|
yaml_permissions = group_details.get('permissions', [])
|
||||||
subject = group.permissions
|
|
||||||
if yaml_permissions:
|
if yaml_permissions:
|
||||||
|
subject = group.permissions
|
||||||
subject.clear()
|
subject.clear()
|
||||||
for yaml_permission in yaml_permissions:
|
for yaml_permission in yaml_permissions:
|
||||||
if '*' in yaml_permission:
|
if '*' in yaml_permission:
|
||||||
|
|
Loading…
Reference in New Issue