Change the format of the user_permissions data that gets sent

The endpoint for setting permissions in api will now be used for both
user permissions and a user's folder permissions, so this changes the
format of the data we pass through.
This commit is contained in:
Katie Smith
2019-02-21 15:06:41 +00:00
parent 6ac713c978
commit 62578f5951
2 changed files with 5 additions and 2 deletions

View File

@@ -164,7 +164,10 @@ class UserApiClient(NotifyAdminAPIClient):
@cache.delete('user-{user_id}')
def set_user_permissions(self, user_id, service_id, permissions):
# permissions passed in are the combined admin roles, not db permissions
data = [{'permission': x} for x in translate_permissions_from_admin_roles_to_db(permissions)]
data = {
'permissions': [{'permission': x} for x in translate_permissions_from_admin_roles_to_db(permissions)]
}
endpoint = '/user/{}/service/{}/permission'.format(user_id, service_id)
self.post(endpoint, data=data)