In order to update the module from previous versions to version 5.0.0, install the newest user module and then perform the following steps:
- Run the profile migration graphql query:
mutation {
records_update_all(sync: false, table: "modules/profile/profile", record: { table: "modules/user/profile" }) {
count
}
}
Validate if all records from the modules/profile/profiles table have been properly migrated to modules/user/profiles.
- Run the following liquid script to migrate roles from user table to the new profile table:
{% liquid
graphql total = 'modules/user/user/count'
assign count = total.users.total_entries
assign pages = count | divided_by: 1000.0 | ceil
for page in (1..pages)
graphql r = 'modules/user/user/search', page: page, limit: 1000, include_profiles: true
for user in r.users.results
assign roles = user.roles
assign profile = user.profiles.first
if profile != null
assign object = '{}' | parse_json | hash_merge: valid: true, id: profile.id, roles: roles
function object = 'modules/core/commands/execute', object: object, mutation_name: 'modules/user/profiles/roles/set'
endif
endfor
endfor
%}
-
Remove the profile module and delete the modules/profile/profile table.
-
Remove roles from user configuration in the app/user.yml file if present.
-
Update application code to use current profile
modules/user/helpers/current_profileinstead of user for checking permissions.