When adding a user new with permissions to a service, the permissions

dao was deleting all permissions for that user (regardless of service
id) as the last filter on the permissions dao get_query method won.

I've added a replace flag to the set_user_service_permission method
so that it can handle adding new users + permissions and editing
of existing users' permissions.

Also by pass the get_query method until it can be refactored to work
correctly.

For now execute the filter query directly on the model.
This commit is contained in:
Adam Shimali
2016-06-07 16:31:10 +01:00
parent a3eb4a643e
commit e28ef237e4
4 changed files with 67 additions and 17 deletions

View File

@@ -188,7 +188,7 @@ def set_permissions(user_id, service_id):
for p in permissions:
p.user = user
p.service = service
permission_dao.set_user_service_permission(user, service, permissions, _commit=True)
permission_dao.set_user_service_permission(user, service, permissions, _commit=True, replace=True)
return jsonify({}), 204