generated from openedx/frontend-template-application
-
Notifications
You must be signed in to change notification settings - Fork 4
feat(authz): [FC-0099] update state to return the libraries roles and permissions metadata #5
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a07b972
feat: update state to return the roles and permissions metadata
dcoa a2e33d4
fix: use role insted of key for roles identifier
dcoa 9aee1e4
fix: update validation request body and getTeamMembers response
dcoa f2f0627
fix: remove extra permissions from libraries metadata
dcoa 84554f3
fix: update the library scope according to the backend requirements
dcoa 3c7acfe
refactor: fix tsdoc for usePermissionsByRole
dcoa 7a834bf
fix: add delete permissions and user the libraryId to retrieve the ma…
dcoa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { PermissionMetadata, ResourceMetadata, RoleMetadata } from 'types'; | ||
|
|
||
| // Note: this information will eventually come from the backend API | ||
| // but for the MVP we decided to manage it in the frontend | ||
| export const libraryRolesMetadata: RoleMetadata[] = [ | ||
| { role: 'library_admin', name: 'Library Admin', description: 'The Library Admin has full control over the library, including managing users, modifying content, and handling publishing workflows. They ensure content is properly maintained and accessible as needed.' }, | ||
| { role: 'library_author', name: 'Library Author', description: 'The Library Author is responsible for creating, editing, and publishing content within a library. They can manage tags and collections but cannot delete libraries or manage users.' }, | ||
| { role: 'library_collaborator', name: 'Library Collaborator', description: 'The Library Collaborator can create and edit content within a library but cannot publish it. They support the authoring process while leaving final publishing to Authors or Admins.' }, | ||
| { role: 'library_user', name: 'Library User', description: 'The Library User can view and reuse content but cannot edit or delete any resource.' }, | ||
| ]; | ||
|
|
||
| export const libraryResourceTypes: ResourceMetadata[] = [ | ||
| { key: 'library', label: 'Library', description: 'Permissions related to the library as a whole.' }, | ||
| { key: 'library_content', label: 'Content', description: 'Permissions to create, edit, delete, and publish individual content items within the library.' }, | ||
| { key: 'library_collection', label: 'Collection', description: 'Permissions to create, edit, and delete content collections within the library.' }, | ||
| { key: 'library_team', label: 'Team', description: 'Permissions to manage user access and roles within the library.' }, | ||
| ]; | ||
|
|
||
| export const libraryPermissions: PermissionMetadata[] = [ | ||
| { key: 'view_library', resource: 'library', description: 'View content, search, filter, and sort within the library.' }, | ||
| { key: 'delete_library', resource: 'library', description: 'Allows the user to delete the library and all its contents.' }, | ||
| { key: 'manage_library_tags', resource: 'library', description: 'Add or remove tags from content.' }, | ||
|
|
||
| { key: 'edit_library_content', resource: 'library_content', description: 'Edit content in draft mode' }, | ||
| { key: 'publish_library_content', resource: 'library_content', description: 'Publish content, making it available for reuse' }, | ||
| { key: 'reuse_library_content', resource: 'library_content', description: 'Reuse published content within a course.' }, | ||
|
|
||
| { key: 'create_library_collection', resource: 'library_collection', description: 'Create new collections within a library.' }, | ||
| { key: 'edit_library_collection', resource: 'library_collection', description: 'Add or remove content from existing collections.' }, | ||
| { key: 'delete_library_collection', resource: 'library_collection', description: 'Delete entire collections from the library.' }, | ||
|
|
||
| { key: 'manage_library_team', resource: 'library_team', description: 'View the list of users who have access to the library.' }, | ||
| { key: 'view_library_team', resource: 'library_team', description: 'Add, remove, and assign roles to users within the library.' }, | ||
| ]; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 is not a blocker comment, but I think it will be helpful to align the name of the permission and the grouping with this: https://openedx.atlassian.net/wiki/spaces/OEPM/pages/4840095745/Library+Roles+and+Permissions#Table-of-Roles-and-Permissions
I know we had something different in the Hi-Fi design, but after discussing it with @gviedma-aulasneo, we agreed that it's best to maintain the grouping as mentioned in the URL.
Note: It only modifies the library and library _content grouping.
Uh oh!
There was an error while loading. Please reload this page.
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.
Thank @MaferMazu I updated it accordingly.