Commit Graph

22 Commits

Author SHA1 Message Date
Katie Smith
bef24408d0 Add DAO function to archive a user
For a user to be able to be archived, each service that they are a
member of must have at least one other user who is active and who has
the 'manage-settings' permission.

To archive a user we remove them from all their services and
organisations, remove all permissions that they have and change some of
their details:
- email_address will start with '_archived_<date>'
- the current_session_id is changed (to sign them out of their current
session)
- mobile_number is removed (so we also need to switch their auth type to
email_auth)
- password is changed to a random password
- state is changed to 'inactive'

If any of the steps fail, we rollback all changes.
2019-06-05 14:54:52 +01:00
Leo Hemsted
28d5f9b87f flake8 - remove unused imports and ensure they're always at the top of the file 2017-11-28 14:28:01 +00:00
Rebecca Law
f56824adde Cancel job if the service is inactive.
Update the PermissionsDao.get_permissions_by_user_id to only return permissions for active services,
this will make the admin app return a 403 if someone (otherthan platform admin) tries to look at an inactive service.
Removed the active flag in sample_service the dao_create_service overiddes this attribute.
2017-02-02 11:34:00 +00:00
Rebecca Law
f8262b13c1 Refactor permissions dao - removed custom query filter
Removed permissions rest - not being used.
2016-06-15 16:32:52 +01:00
Adam Shimali
e28ef237e4 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.
2016-06-07 16:35:26 +01:00
Adam Shimali
63c29a3a3d API recieves full set of permissions names on create of user
invite. This is instead of mapping from permission groups to individual
permissions on user creation.
2016-06-06 12:37:06 +01:00
Nicholas Staples
fac34aff10 Added functionality to allow filtering by multiple arguments.
Removed commented out code.
2016-04-04 13:21:51 +01:00
Rebecca Law
c7c845cea6 Remove access_developer_docs as a permission type. It does not make sense to have permission for viewing the documentation.
On the downgrade method of the db script the assumption that all users with manage_api_keys had the access_developer_docs permission.
2016-03-29 17:00:42 +01:00
Rebecca Law
376a074f5f Add view_activity permission so that users can have the default permission to see activity.
Add view_activity to default permissions when adding a new user.
Add view_activity as a permission group, used when inviting a user.
2016-03-29 15:35:34 +01:00
Nicholas Staples
3a59c75257 Transaction management added for one example. All tests passing. 2016-03-23 16:30:47 +00:00
Nicholas Staples
090babaaeb Added endpoint for removing user from service, all tests passing. 2016-03-22 13:14:23 +00:00
Nicholas Staples
ebec54cb80 Permission enums corrected, all tests passing. 2016-03-02 15:34:26 +00:00
Nicholas Staples
01f616eeac Fix all tests. 2016-03-02 11:10:52 +00:00
Nicholas Staples
47c4368007 Merge with master. 2016-03-01 17:18:46 +00:00
Nicholas Staples
918d40cc9d Functionality added and all tests working. 2016-03-01 14:21:28 +00:00
Nicholas Staples
7d43b4265f Merge and fix conflicts. 2016-03-01 11:59:50 +00:00
Rebecca Law
ecbfbbc6b0 Fix bug in PermissionDAO
Refactor user/test_rest
Remove conftest/sample_admin_service
2016-03-01 10:34:27 +00:00
Nicholas Staples
47ac0b8a98 Fixed some tests. 2016-02-29 18:32:25 +00:00
Nicholas Staples
8ad13b6356 Manage template permission added. All tests passing. 2016-02-29 15:21:35 +00:00
Nicholas Staples
2cf2b51cd9 Fix for git commit review. 2016-02-29 11:50:43 +00:00
Nicholas Staples
9b73b0d9f8 Default permissions added on service creation. All tests working. 2016-02-26 17:11:30 +00:00
Nicholas Staples
16e1ecb134 Working permissions and all tests passing.
Remove print statements.

Fix for review comments.
2016-02-26 15:00:29 +00:00