Skip to content

fix: ui permission - #7734

Merged
wxg0103 merged 1 commit into
v3from
pr@v3@fix_permission
Nov 9, 2026
Merged

wxg0103 merged 1 commit into
v3from
pr@v3@fix_permission

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: ui permission

APPLICATION_CLEAR_POLICY: p(Group.APPLICATION, Group.APPLICATION, Operate.CLEAR_POLICY, 42),
APPLICATION_RESOURCE_AUTHORIZATION: p(Group.APPLICATION, Group.APPLICATION, Operate.AUTH, 10),
APPLICATION_RELATE_RESOURCE_VIEW: p(Group.APPLICATION, Group.APPLICATION, Operate.RELATE_VIEW, 11),
APPLICATION_TRIGGER_READ: p(Group.APPLICATION, Group.APPLICATION, Operate.TRIGGER_READ, 12),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's my review of the diff:

Irregularities / Potential Issues

  1. Magic number 42 for the permission code. Other entries use sequential codes (7, 8, 9, 10, 11, 12). The jump to 42 is suspicious—likely conflicts with, or leaves gaps from, other permissions. Verify:

    • That 42 isn't already assigned elsewhere in this file or sibling constant files.
    • Whether an existing constant/enum (e.g., Operate.CLEAR_POLICY) already defines the numeric value, so you can reference it instead of hardcoding.
    • That the intended behavior is "gap allowed" rather than a typo (e.g., should be 9.5-style or 13).
  2. Operate.CLEAR_POLICY may not exist yet. If this is the first usage, ensure it's added to the Operate enum and that any backend/permission-mapping tables are updated in the same change—otherwise runtime lookups will fail.

  3. Ordering inconsistency. The new entry is inserted between BATCH_MOVE (9) and RESOURCE_AUTHORIZATION (10), but its code is 42. This breaks the visual/numeric ordering convention of the block and makes future diffs harder to scan. Consider placing it at the end of the APPLICATION_* group or beside other high-numbered codes.

  4. Naming/scope mismatch (minor). The key is APPLICATION_CLEAR_POLICY but both groups are Group.APPLICATION. Confirm this permission is genuinely application-scoped and not resource-level; if it belongs elsewhere, the group args should reflect that.

  5. Backward compatibility. Adding a permission to a shared constants export can affect serialization (e.g., if consumers enumerate PermissionConstants and persist indices). Confirm no consumer relies on positional/contiguous numbering.

Optimization Suggestions

  • Define the code via a named constant (e.g., Operate.CLEAR_POLICY = 42 or a CODE map) rather than an inline literal, to keep a single source of truth.
  • Add a brief comment noting why 42 is used (if intentional) or renumber.
  • If permission codes must remain unique across modules, add/extend a unit test asserting uniqueness of all values in PermissionConstants.
  • Ensure corresponding authorization tests cover the new permission.

Summary: Functionally likely fine, but verify the 42 code doesn't collide, confirm Operate.CLEAR_POLICY is defined, and consider ordering/naming consistency plus a uniqueness test.

@wxg0103
wxg0103 merged commit 7d325e2 into v3 Nov 9, 2026
3 of 4 checks passed
@wxg0103
wxg0103 deleted the pr@v3@fix_permission branch November 9, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants