User profile storage
In addition to a username, Magnolia stores various user profile preferences.
User profile information for JCR users is stored in different workspaces that may only be accessed by the superuser
.
JCR-based users have the following information stored:
-
In the
users
workspace:-
Full name
-
Email address
-
Last login
-
Previous login
-
Time zone
-
Language
-
-
In the
profiles
workspace:-
Favorite apps
-
Completed intro status (Magnolia app launcher tour)
-
Usage metrics acknowledgement status
-
User profile preferences related to the Magnolia instance for SSO users is stored in the profiles
workspace that may only be accessed by the superuser
.
The following information is stored in the profiles
workspace for SSO users:
-
Full name
-
Email
-
Favorite apps
-
Language
-
Last login
-
Previous login
-
Timezone
-
Completed intro status (Magnolia app launcher tour)
-
Usage metrics acknowledgement status
SSO users can set their user preferences for timezone and language in AdminCentral. |
The information for each user is stored based on the username from the third-party IdP. If you change a user’s username in your IdP, their preferences are reset in Magnolia.
Paths to user profiles in the profiles
workspace
The profiles
workspace is hierarchically structured and encrypted to avoid performance issues when storing many user profiles.
User profiles are created automatically. We don’t recommend bootstrapping profiles because the structure is created automatically and could change in future. |
If you need to generate the path to a given user in the profiles workspace, you can use this groovy script:
superuser
in the profiles
workspaceimport info.magnolia.cms.security.userprofile.jcr.HierarchicalProfilePathResolver;
import info.magnolia.cms.security.SecuritySupport;
String userName = "superuser" (1)
new HierarchicalProfilePathResolver().getProfilePath(SecuritySupport.Factory.getInstance().getUserManager().getUser(userName));
1 | The user’s ID or username, in this example, superuser . |
This script returns something similar to:
====> /jcr/2a/67/00/82/NTFhZTMzNzktNjdjZi00OTk0LTllMDUtZjk3Y2I4YmMzZTRh
Changing user profiles programmatically
To access user profile preferences, to set favorite apps for users for example, inject the info.magnolia.cms.security.userprofile.jcr.HierarchicalUserProfileManager class.
Retrieve UserPreferencesProfile
with HierarchicalUserProfileManager#getUserProfile
then change the values and store them back with the HierarchicalUserProfileManager#saveUserProfile
method.