[feature]: Allow non-admin users to access import settings#353
[feature]: Allow non-admin users to access import settings#353deeonwuli wants to merge 1 commit into
Conversation
…ding import settings access
BundleMonNo change in files bundle size Groups updated (1)
Final result: ✅ View report in BundleMon website ➡️ |
| "Les modifications sur 'Qui a accès' aux paramètres seront prises en compte " | ||
| "après le rechargement de la page" | ||
|
|
||
| #, fuzzy |
There was a problem hiding this comment.
can we remove the fuzzy translations? Here, but also for PT and PT_BR
| .run(setCurrentUserHasAccessToImportSettings, console.error); | ||
| }, [compositionRoot.users]); | ||
|
|
||
| const showSettingsIcon = currentUserHasAccessToSettings || currentUserHasAccessToImportSettings; |
There was a problem hiding this comment.
I'm not sure about this change. This means that users who have access to the import action can now open the 'settings' modal and configure any permission. This was not part of the task, so maybe we should stick to the previous logic?
| userGroupIds: user.userGroups.map(getId), | ||
| }; | ||
|
|
||
| return ( |
There was a problem hiding this comment.
The whole usecase is ok, but this is almost the same logic we have in CheckCurrentUserCanAccessSettingsUseCase.ts. I think we can have only one usecase and instead returning a boolean we can return a new type:
type UserSettingsAccess = {
accessToSettings: boolean;
accessToImport: boolean;
}and now we can centralize every access logic in this usecase so in the future we don't need one usecase for every new setting and also we save hitting the server with the same two requests to get the current user and the appsettings. Does this make sense? What do you think?
📌 References
📝 Implementation
Adds a new
importSettingsAccesspermission field toAppSettings(stored in theuser-extended-app-settingsconstant). Non-admin users listed in this field can open the settings dialog and see only the Import tab, without access to the rest of the settings.CheckCurrentUserCanAccessImportSettingsUseCasechecks: super admin, full settings access, or import-only access📹 Screenshots/Screen capture
🔥 Testing
#869dn72ua