Refactor user permissions to use args, not list

This makes the interface a bit cleaner and less verbose.
This commit is contained in:
Chris Hill-Scott
2017-10-15 15:02:01 +01:00
parent 6531a0c761
commit d9a63c07a9
18 changed files with 38 additions and 38 deletions

View File

@@ -92,10 +92,9 @@ def edit_user_permissions(service_id, user_id):
user_has_no_mobile_number = user.mobile_number is None
form = PermissionsForm(
**{role: user.has_permissions(permissions=permissions) for role, permissions in roles.items()},
**{role: user.has_permissions(*permissions) for role, permissions in roles.items()},
login_authentication=user.auth_type
)
if form.validate_on_submit():
user_api_client.set_user_permissions(
user_id, service_id,
@@ -122,7 +121,7 @@ def remove_user_from_service(service_id, user_id):
# Need to make the email address read only, or a disabled field?
# Do it through the template or the form class?
form = PermissionsForm(**{
role: user.has_permissions(permissions=permissions) for role, permissions in roles.items()
role: user.has_permissions(*permissions) for role, permissions in roles.items()
})
if request.method == 'POST':