Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a capability-based permission layer to gate non-admin UI actions at the button/flow level, aligning frontend policy evaluation more closely with current RustFS behavior (deny precedence, NotAction/NotResource, wildcard/action alias handling).
Changes:
- Introduces
permission-capabilities+permission-resourcesto map UI capabilities to backend actions and S3 resource ARNs. - Extends
console-policy-parserto better match RustFS semantics (aliases, NotResource, console/admin nuances). - Updates multiple pages/components to hide/disable actions and add submit-path guards using
usePermissions().canCapability(...).
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/permission-resources.ts | Adds helpers to build bucket/object/prefix S3 ARNs for permission checks. |
| lib/permission-capabilities.ts | Defines ConsoleCapability and maps capabilities to backend actions + resource targets. |
| lib/console-policy-parser.ts | Expands policy parsing semantics (NotResource, alias normalization, deny precedence alignment). |
| hooks/use-permissions.tsx | Exposes canCapability(capability, context?) from the permissions context. |
| components/user/edit-form.tsx | Gates user edit tabs and submit-path operations by capability. |
| components/object/versions.tsx | Gates per-version preview/download/delete buttons using capability checks. |
| components/object/upload-picker.tsx | Adds canUpload prop and blocks upload interactions when unauthorized. |
| components/object/list.tsx | Gates object row actions and bulk actions; hides upload button when unauthorized. |
| components/object/info.tsx | Gates object actions (download/preview/tags/legal hold/retention/share/versions) and adds submit guards. |
| components/events/columns.tsx | Adds canDelete parameter to control delete button visibility in event rows. |
| components/buckets/replication-tab.tsx | Gates replication rule add/delete UI and delete handler by capability. |
| components/buckets/new-form.tsx | Gates bucket creation and advanced options (versioning/object lock/quota) by capability. |
| components/buckets/lifecycle-tab.tsx | Gates lifecycle rule add/delete UI and delete handler by capability. |
| components/buckets/info.tsx | Gates bucket policy/encryption/tags/versioning/quota/retention UI and adds submit guards. |
| components/buckets/events-tab.tsx | Gates bucket event subscription add/delete UI and delete handler by capability. |
| app/(dashboard)/users/page.tsx | Gates user CRUD/bulk actions and “add to group” by capability. |
| app/(dashboard)/policies/page.tsx | Gates policy create/edit/delete actions by capability. |
| app/(dashboard)/events/page.tsx | Updates getEventsColumns call signature (still hardcoded canDelete=true). |
| app/(dashboard)/browser/page.tsx | Gates bucket create/delete actions by capability. |
| app/(dashboard)/browser/content.tsx | Computes upload capability for current bucket/prefix and passes to list/upload picker. |
| app/(dashboard)/access-keys/page.tsx | Gates access key CRUD/bulk delete actions by capability. |
| BUTTON_PERMISSION_CONTROL_SUMMARY.md | Documents capability mapping, controlled buttons, and rollout notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Type of Change
Related Issues
Summary of Changes
permission-capabilitiesandpermission-resourcesto map UI actions to backend permissions and S3 resource scopesDenyprecedence,NotAction,NotResource, wildcard normalization, and RustFS action alias handlingcanCapability(capability, context?)fromusePermissionsfor page-level and component-level permission checksBUTTON_PERMISSION_CONTROL_SUMMARY.mdto document capability mapping, controlled buttons, README-ready text, and PR-ready notesChecklist
pnpm install --frozen-lockfilepnpm tsc --noEmitpnpm lintpnpm prettier --check .Impact
Additional Notes
/eventsis only partially adapted in this change and still needs follow-up capability-based gatingpnpm test:runis not available in the currentpackage.json, so no automated test script could be executed for this PRpnpm lintcompletes successfully with one existing warning incomponents/object/preview-modal.tsxfor@next/next/no-img-element