Skip to content

Commit

Permalink
feat: refine ui permissions check (#29)
Browse files Browse the repository at this point in the history
完善 UI  权限控制。

/kind feature

```release-note
完善 UI  权限控制。
```
  • Loading branch information
ruibaby committed Sep 21, 2023
1 parent cf52f9d commit c340509
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
10 changes: 9 additions & 1 deletion console/src/index.ts
Expand Up @@ -25,7 +25,7 @@ export default definePlugin({
component: AppStore,
meta: {
title: "应用市场",
permissions: [],
permissions: ["system:appstore:manage"],
menu: {
name: "应用市场",
group: "system",
Expand All @@ -43,6 +43,7 @@ export default definePlugin({
component: PrivacyPolicy,
meta: {
title: "Halo 应用市场隐私政策",
permissions: ["system:appstore:manage"],
},
},
},
Expand All @@ -58,6 +59,7 @@ export default definePlugin({
type: "PLUGIN",
},
priority: 0,
permissions: ["system:appstore:manage"],
},
];
},
Expand All @@ -71,6 +73,7 @@ export default definePlugin({
type: "THEME",
},
priority: 11,
permissions: ["system:appstore:manage"],
},
];
},
Expand All @@ -83,6 +86,7 @@ export default definePlugin({
props: {
plugin: plugin,
},
permissions: ["system:appstore:manage"],
},
{
priority: 42,
Expand All @@ -92,6 +96,7 @@ export default definePlugin({
plugin: plugin,
},
hidden: !!plugin.value.metadata.annotations?.[STORE_APP_ID],
permissions: ["system:appstore:manage"],
},
];
},
Expand All @@ -103,6 +108,7 @@ export default definePlugin({
props: {
theme,
},
permissions: ["system:appstore:manage"],
},
{
priority: 1,
Expand All @@ -111,6 +117,7 @@ export default definePlugin({
theme,
},
hidden: !!theme.value.metadata.annotations?.[STORE_APP_ID],
permissions: ["system:appstore:manage"],
},
];
},
Expand All @@ -123,6 +130,7 @@ export default definePlugin({
appId: plugin.value.metadata.annotations?.[STORE_APP_ID],
},
hidden: !plugin.value.metadata.annotations?.[STORE_APP_ID],
permissions: ["system:appstore:manage"],
},
];
},
Expand Down
14 changes: 7 additions & 7 deletions src/main/resources/extensions/store-role-template.yaml
Expand Up @@ -5,14 +5,14 @@ metadata:
labels:
halo.run/role-template: "true"
annotations:
rbac.authorization.halo.run/module: "Appstore Management"
rbac.authorization.halo.run/display-name: "Appstore Management"
rbac.authorization.halo.run/module: "AppStore Management"
rbac.authorization.halo.run/display-name: "AppStore Management"
rbac.authorization.halo.run/ui-permissions: |
["system:appstore:manage"]
rbac.authorization.halo.run/dependencies: |
[ \"role-template-manage-plugins\", \"role-template-manage-themes\" ]
[ "role-template-manage-plugins", "role-template-manage-themes" ]
rules:
- apiGroups: [ "" ]
resources: [ "secret" ]
resourceNames: [ "halo-run-app-store-pat-secret" ]
verbs: [ "create", "update", "get", "delete" ]
- apiGroups: [""]
resources: ["secret"]
resourceNames: ["halo-run-app-store-pat-secret"]
verbs: ["create", "update", "get", "delete"]

0 comments on commit c340509

Please sign in to comment.