Skip to content

feat: system identity user permission - #7741

Merged
peslyn merged 1 commit into
v3from
pr@v3@feat_system_identity_user_permission
Nov 9, 2026
Merged

peslyn merged 1 commit into
v3from
pr@v3@feat_system_identity_user_permission

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

feat: system identity user permission

<ButtonChangeUserPassword v-if="perm.system.user.edit()" :user="row" @refresh="loadSystemUsers(false)" />
<!-- 删除 -->
<MkTooltip content="删除" placement="top" v-if="perm.system.user.delete()">
<el-button type="primary" text @click.stop="deleteUser(row)">

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 this diff:

Summary of the change:
A permission check v-if="perm.system.user.edit()" was added to ButtonChangeUserPassword, aligning it with the adjacent delete button which already has a permission guard.

Assessment:

  1. Good — Consistency improved: The delete button already had v-if="perm.system.user.delete()", but the "change password" button had none. Adding a permission gate is the correct fix.

  2. Questionable — Correct permission used? Changing a user's password may not logically map to the edit permission. Verify whether:

    • There is (or should be) a distinct permission such as perm.system.user.changePassword() / resetPassword().
    • Password changes should require a stronger privilege than a general "edit" (this is a sensitive, security-critical operation). Consider whether edit() is the right gate or if it silently grants too much.
  3. Potential issue — Backend enforcement: A front-end v-if only hides the UI. Ensure the backend API endpoint that changes/resets a user's password also enforces the same permission (never rely on the client). Confirm this exists.

  4. Consistency nit: The other buttons (MkTooltip, delete) use different wrapper patterns. Here v-if is placed directly on ButtonChangeUserPassword, whereas delete wraps el-button in an MkTooltip. That's fine, but confirm ButtonChangeUserPassword renders nothing undesirable when hidden (e.g., no stray tooltip/wrapper). Since v-if removes the whole component, this is OK.

  5. No hook/binding concern visible: Nothing in this hunk suggests reactivity problems; perm appears to be a reactive object used elsewhere in the template.

  6. Style: Inline v-if is consistent with the surrounding code — acceptable here.

Recommendation: Keep the change (it fixes a real UI-permission gap), but (a) confirm perm.system.user.edit() is the semantically correct and sufficiently privileged check for password changes, and (b) verify the backend enforces the same check. If password reset warrants its own permission, use that instead.

@peslyn
peslyn merged commit 6368902 into v3 Nov 9, 2026
3 of 4 checks passed
@peslyn
peslyn deleted the pr@v3@feat_system_identity_user_permission branch November 9, 2026 05:44
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