-
Notifications
You must be signed in to change notification settings - Fork 11
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
users: create user record on registration #235
Conversation
@@ -67,9 +67,15 @@ def import_users(infile): | |||
password = hash_password(password) | |||
del user_data['password'] | |||
|
|||
if not user_data.get('roles'): | |||
user_data['roles'] = [UserRecord.ROLE_USER] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not having the roles in the fixtures file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally it's the case, it's just to insure that the user as at least the role "user".
roles = [] | ||
|
||
for role in roles: | ||
if not datastore.find_role(role): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this take while it can be afterward with a unique list of collected roles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really sure, because we need the roles to create user account just after. But maybe yes, we can collect all roles before and create them before creating users.
:param user: User account. | ||
""" | ||
# Add a default role to user | ||
role = datastore.find_role(UserRecord.ROLE_USER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not doing this in the UserRecord class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not related to UserRecord, but to Flask account created, which has no role.
* Creates a user record when a new account is registered. * Disables `invenio-userprofiles` module. * Exposes and uses user record for displaying user information in templates. * Gives role `user` by default when a new record is created. * Removes `organisation` from required fields for users. * Hides `applications` and `security` menu entries. * Creates a new page for editing user data. * Removes useless CSS rules * Adds CSS rules for standalone editor. * Customizes settings page. Co-Authored-by: Sébastien Délèze <[email protected]>
invenio-userprofiles
module.user
by default when a new record is created.organisation
from required fields for users.applications
andsecurity
menu entries.Co-Authored-by: Sébastien Délèze [email protected]
How to test
Standard registration form
Switch edu-ID
ORCID