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/application-detail/overview/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ onMounted(() => {
<MkIcon name="icon_copy_outlined" />
</el-button>
<!-- 重置访问链接 -->
<el-button text :loading="loading" @click="handleResetAccessToken">
<el-button v-if="applicationOverviewPermission('overviewPublic')" text :loading="loading" @click="handleResetAccessToken">
<MkIcon name="icon_refresh_outlined" />
</el-button>
</div>

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.

The one-line change is syntactically valid Vue template code. No obvious syntax irregularity in the diff. However, there are several review points:

  1. Permission semantics may be wrong

    • overviewPublic sounds like a “view public overview” permission, not necessarily a permission to reset an access token.
    • Resetting an access link is a security-sensitive write action. Use a dedicated permission such as overviewPublicResetToken / resetAccessToken if available.
    • Confirm the permission key with the backend/RBAC design.
  2. Frontend hiding is not authorization

    • v-if only hides the button. The reset API must still enforce the same permission server-side and return 403 if unauthorized.
  3. Reactivity concern

    • If applicationOverviewPermission() depends on a reactive permission store, the template will re-render correctly.
    • If it reads from a non-reactive global or is async, v-if may not update correctly. Prefer a computed property:
const canResetAccessToken = computed(() =>
  applicationOverviewPermission('overviewPublicResetToken')
)
<el-button
  v-if="canResetAccessToken"
  text
  :loading="loading"
  @click="handleResetAccessToken"
>
  <MkIcon name="icon_refresh_outlined" />
</el-button>
  1. Ensure the permission function returns a synchronous boolean

    • If it returns a Promise, v-if will treat it as truthy. Permission checks in templates should be synchronous.
  2. Check import/definition

    • Make sure applicationOverviewPermission is imported or defined in this component; otherwise it will fail at runtime.
  3. Shared loading state

    • If loading is shared by multiple buttons/actions, resetting the token may make unrelated buttons show loading. Consider a dedicated resettingAccessToken state.
  4. UX/security suggestions

    • Add a confirmation dialog before resetting the access link.
    • Handle API success/failure and clear loading in finally.
    • Add aria-label or title for the icon-only button, e.g. “Reset access link”.
    • Add tests for permission granted/denied behavior.

Overall: the change is safe syntactically, but verify the permission key is the correct one, keep the check reactive, and ensure backend authorization is also enforced.

Expand Down
Loading