Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/views/system/identity/users/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ onMounted(() => loadSystemUsers())
</el-button>
</MkTooltip>
<!-- 修改用户密码 -->
<ButtonChangeUserPassword :user="row" @refresh="loadSystemUsers(false)" />
<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.

Expand Down
Loading