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

Backend: Accounts: Migrate primary key from int to uuid #403

Open
lnielsen opened this issue Apr 5, 2022 · 0 comments
Open

Backend: Accounts: Migrate primary key from int to uuid #403

lnielsen opened this issue Apr 5, 2022 · 0 comments

Comments

@lnielsen
Copy link
Member

lnielsen commented Apr 5, 2022

We need to move the primary key on the user table from an integer to a random uuid.

Here's a review of what would need to be changed:

# Tables with FKs to users
- invenio_access: ActionUsersm, UserRole
- invenio_accounts: Login information, Session activity, User identity,
- invenio_communities: CommunityMembers
- invenio_oauth2server: Token, Client
- invenio_oauthclient: RemoteAccount,
- invenio_userprofiles: UserProfile

# JSONSchemas and mappings with user ids
requestevents
- creator
requests
- creator/receiver
rdmrecords
- owned_by, grants, links
communitymembers
- user_id
users

# Modules with imports from Flask-Login that needs to be checked
flask_security
invenio_access
invenio_accounts
invenio_admin
invenio_app
invenio_app_rdm
invenio_cache
invenio_communities
invenio_files_rest
invenio_i18n
invenio_logging (direct test dependency)
invenio_oauth2server
invenio_oauthclient
invenio_records_rest (direct test dependency)
invenio_records_ui
invenio_requests
invenio_userprofiles
sentry_sdk
sqlalchemy_continuum

# Code to review that might need to be updated to work with the strs instead of ints
./sqlalchemy_continuum/plugins/flask.py:39:        return current_user.id
./flask_security/core.py:221:        identity = Identity(current_user.id)
./flask_security/core.py:227:        identity.provides.add(UserNeed(current_user.id))
./invenio_userprofiles/forms.py:82:                    current_user.id == user_profile.user_id
./flask_security/core.py:221:        identity = Identity(current_user.id)
./flask_security/core.py:226:    if hasattr(current_user, 'id'):
./flask_security/core.py:227:        identity.provides.add(UserNeed(current_user.id))
./invenio_oauth2server/templates/invenio_oauth2server/authorize.html:22:                        client_name=client.name, client_user=client.user.nickname or client.user.email, current_user=current_user.nickname or current_user.email) }}</h3>
./invenio_oauth2server/templates/semantic-ui/invenio_oauth2server/authorize.html:23:      {{ _("Application '%(client_name)s' by '%(client_user)s' wants permission to access your '%(current_user)s' account.",
./invenio_oauth2server/templates/semantic-ui/invenio_oauth2server/authorize.html:26:          current_user=current_user.nickname or current_user.email,
./invenio_oauth2server/ext.py:56:        bind_cache_grant(app, oauth2, lambda: OAuthUserProxy(current_user))
./invenio_oauthclient/contrib/cern.py:352:    provides = set([UserNeed(current_user.email)] + [
./invenio_oauthclient/contrib/cern.py:453:    if not current_user.is_authenticated:

# Review of UserNeed
./invenio_records_resources/references/resolvers/users.py:29:        return [UserNeed(user_id)]
./invenio_communities/generators.py:232:            return [UserNeed(member.user_id)]
./flask_security/core.py:227:        identity.provides.add(UserNeed(current_user.id))
./invenio_records_permissions/__init__.py:64:            return [UserNeed(owner) for owner in record.get('owners', [])]
./invenio_records_permissions/generators.py:134:        return [UserNeed(owner) for owner in record.get('owners', [])]
./invenio_records_permissions/generators.py:222:            UserNeed(identity.get('id')) for identity in allowed_identities
./invenio_rdm_records/records/systemfields/access/grants.py:101:            need = UserNeed(self.subject.id)
./invenio_rdm_records/fixtures/tasks.py:34:    identity.provides.add(UserNeed(user_id))
./invenio_rdm_records/fixtures/tasks.py:54:    identity.provides.add(UserNeed(user_id))
./invenio_rdm_records/services/generators.py:103:            UserNeed(owner.owner_id) for owner in record.parent.access.owners
./invenio_access/models.py:131:        return UserNeed(self.user_id)
./invenio_access/utils.py:22:        identity.provides.add(UserNeed(user.id))
./invenio_access/permissions.py:107:        Permission(UserNeed('1'), RoleNeed('admin'))
./invenio_oauthclient/contrib/cern.py:352:    provides = set([UserNeed(current_user.email)] + [
./invenio_oauthclient/contrib/cern_openid.py:210:        [UserNeed(current_user.email)] + [RoleNeed(name) for name in roles]
@lnielsen lnielsen changed the title models: change primary key from int to uuid Backend: Accounts: Migrate primary key from int to uuid Apr 6, 2022
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

No branches or pull requests

1 participant