Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user: synchronize user records and security accounts #203

Merged
merged 1 commit into from
May 27, 2020
Merged

user: synchronize user records and security accounts #203

merged 1 commit into from
May 27, 2020

Conversation

sebdeleze
Copy link
Contributor

@sebdeleze sebdeleze commented Apr 28, 2020

  • Creates an account when a user record is created with a new email address.
  • Synchronizes roles when a user record is updated.
  • Removes account roles when a user is deleted.
  • Adds a "user" cached property for storing account in user record.
  • Configures the record class for user REST item route.
  • Adds a method to retrieve persistent identifier object from a record.
  • Adds a custom method for deleting a record in record base class (SonarRecord).
  • Adds a fixture for creating roles in tests.

Co-Authored-by: Sébastien Délèze sebastien.deleze@rero.ch

How to test

Create user

  1. Login as superuser and go to admin and create a new user with an existing email address (user rero.sonar+[xxxx]@gmail.com.
  2. Click the link in the received email to reset the password.
  3. Change the password and verify that user is logged.

Check role

  1. Follow create user procedure.
  2. Login as superuser and go to Super admin / User Management / Users and edit created user.
  3. User has the right role associated.

Add role

  1. Follow create user procedure.
  2. Login as superuser and add a new role for user created in step 1.
  3. Follow check role procedure to validate that user account as the new role.

Remove user

  1. Follow create user procedure.
  2. Follow check role procedure.
  3. Login as superuser and remove user.
  4. Go to Super admin / User Management / Users and edit created user.
  5. Verify that the account has no role and is deactivated.
  6. Try to login with account, the login will fail.

Reactivate account

  1. Re-create user with same email.
  2. Go to Super admin / User Management / Users and edit created user.
  3. Verify that the account has roles and is activated.
  4. Verify user can login successfully.

@sebdeleze sebdeleze marked this pull request as ready for review May 1, 2020 11:50
@sebdeleze sebdeleze requested a review from jma May 19, 2020 12:07
@@ -121,6 +121,8 @@ def _(x):
#: proxies) removes these headers again before sending the response to the
#: client. Set to False, in case of doubt.
ACCOUNTS_USERINFO_HEADERS = True
# make security blueprints available to the REST API
ACCOUNTS_REGISTER_BLUEPRINT = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learnt something here.

* Creates an account when a user record is created with a new email address.
* Synchronizes roles when a user record is updated.
* Removes account roles when a user is deleted.
* Removes useless "user_id" property as user are linked with emails.
* Adds a "user" cached property for storing account in user record.
* Configures the record class for user REST item route.
* Adds a method to retrieve persistent identifier object from a record.
* Adds a custom method for deleting a record in record base class (SonarRecord).
* Adds a fixture for creating roles in tests.
* Registers templates for SONAR before others, for overriding flask security templates.
* Registers security blueprints in REST application.
* Forces to point reset password link to UI application.
* Closes #204.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
@sebdeleze sebdeleze merged commit f5edda2 into rero:dev May 27, 2020
@sebdeleze sebdeleze deleted the sed-sync-account branch May 27, 2020 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants