Implement Rest api to update role permissions on asset [#33918]#33925
Merged
Implement Rest api to update role permissions on asset [#33918]#33925
Conversation
1. New GET /permissions/{assetId} endpoint - View asset permissions with pagination, supporting all permissionable types (folders, hosts, contentlets, etc.)
2. Permission helper infrastructure - Added AssetPermissionHelper for building responses and ResponseEntityAssetPermissionsView for typed API responses, integrated via CDI
3. Documentation and tests - OpenAPI spec updates and comprehensive Postman test suite covering happy paths, pagination, validation, and error cases
…-api-to-update-asset-permissions
- PUT /api/v1/permissions/{assetId} - REST endpoint to save/update asset permissions (admin-only)
- Auto-breaks inheritance when saving on inheriting asset, supports ?cascade=true for async propagation
- Returns message, permissionCount, inheritanceBroken, and updated asset object
- Reset API: PUT /api/v1/permissions/{assetId}/_reset removes individual permissions, making asset inherit from parent
- Idempotency: Returns 409 Conflict if asset already inherits; includes previousPermissionCount in response
- Admin-only: Restricted to admin users for safety
…33917-rest-api-to-view-role-permissions
- Added GET /api/v1/permissions/role/{roleId} endpoint to retrieve all permissions for a role
- Authorization: admins can view any role, non-admins can only view roles they belong to
- Added integration tests (6 methods) and Postman tests (5 requests)
- New REST API endpoint to update role permissions on assets (PUT /api/v1/permissions/assets/{assetId}/roles) with UpdateRolePermissionsForm for request body and ResponseEntityUpdateRolePermissionsView
for response
- Extended AssetPermissionHelper with logic to process role permission updates, including validation and permission application for specified roles on assets
- Comprehensive integration tests covering the new update role permissions functionality with various scenarios and OpenAPI spec additions
…-get-asset-permissions
- fix constructor calls
…-get-asset-permissions
- use immutables for views - use established paginator pattern to return paginated results - refactor assetPermissionHelper and return typed views.
…o-update-asset-permissions
- integration tests added for PUT /permissions/{assetId} - basic update, validation errors, inheritance breaking, security checks
- Pattern alignment - forms extend Validated with checkValid(), typed immutable response views, OpenAPI spec updates
- refactor and use permissionUtils and enums where applicable. - fix integration tests.
…-get-asset-permissions
Contributor
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
…o-update-asset-permissions
…rest-api-to-reset-permissions-for-an-asset
- Refactored reset permissions endpoint to use typed @Value.Immutable view class instead of Map<String, Object>, matching the pattern used by updateAssetPermissions.
…33917-rest-api-to-view-role-permissions
- use typed views - refactored PermissionSaveHelper to delegate to PermissionConversionUtils - fix integration tests.
…k-rest-api-to-update-role-permissions-on-asset
…s for type-safe permission handling
…rest-api-to-reset-permissions-for-an-asset
…ous exception in tests. #33914
…-api-to-reset-permissions-for-an-asset
…33917-rest-api-to-view-role-permissions
…k-rest-api-to-update-role-permissions-on-asset
…-rest-api-to-update-role-permissions-on-asset
…-rest-api-to-update-role-permissions-on-asset
freddyDOTCMS
approved these changes
Jan 13, 2026
jcastro-dotcms
approved these changes
Jan 13, 2026
…-rest-api-to-update-role-permissions-on-asset
fabrizzio-dotCMS
approved these changes
Jan 13, 2026
3 tasks
dsolistorres
pushed a commit
that referenced
this pull request
Feb 20, 2026
### Proposed Changes
- New REST API endpoint to update role permissions on assets (PUT
/api/v1/permissions/assets/{assetId}/roles) with
UpdateRolePermissionsForm for request body and
ResponseEntityUpdateRolePermissionsView
for response
- Extended AssetPermissionHelper with logic to process role permission
updates, including validation and permission application for specified
roles on assets
- Comprehensive integration tests covering the new update role
permissions functionality with various scenarios and OpenAPI spec
additions
### Checklist
- [ ] Tests
- [ ] Translations
- [ ] Security Implications Contemplated (add notes if applicable)
### Additional Info
** any additional useful context or info **
### Screenshots
Original | Updated
:-------------------------:|:-------------------------:
** original screenshot ** | ** updated screenshot **
This PR fixes: #33918
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed Changes
for response
Checklist
Additional Info
** any additional useful context or info **
Screenshots
This PR fixes: #33918
This PR fixes: #33918