mirror of https://github.com/halo-dev/halo
Merge pull request #5291 from ruibaby/fix/pat-roles
fix: issue of non-template roles being displayed in personal token rolespull/5310/head
commit
7543fb6346
|
@ -6,6 +6,7 @@ export enum pluginLabels {
|
|||
// role
|
||||
export enum roleLabels {
|
||||
TEMPLATE = "halo.run/role-template",
|
||||
HIDDEN = "halo.run/hidden",
|
||||
SYSTEM_RESERVED = "rbac.authorization.halo.run/system-reserved",
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@ import { Dialog, Toast, VButton, VModal, VSpace } from "@halo-dev/components";
|
|||
import { useMutation, useQueryClient } from "@tanstack/vue-query";
|
||||
import { useClipboard } from "@vueuse/core";
|
||||
import type { PatSpec, PersonalAccessToken } from "@halo-dev/api-client";
|
||||
import { ref } from "vue";
|
||||
import { computed, ref } from "vue";
|
||||
import { useRoleTemplateSelection } from "@/composables/use-role";
|
||||
import { useRoleStore } from "@/stores/role";
|
||||
import { toRefs } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { roleLabels } from "@/constants/labels";
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
const { t } = useI18n();
|
||||
|
@ -45,8 +45,17 @@ const formState = ref<
|
|||
|
||||
const { permissions } = useRoleStore();
|
||||
|
||||
const availableRoleTemplates = computed(() => {
|
||||
return permissions.permissions.filter((role) => {
|
||||
return (
|
||||
role.metadata.labels?.[roleLabels.TEMPLATE] === "true" &&
|
||||
role.metadata.labels?.[roleLabels.HIDDEN] !== "true"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
const { roleTemplateGroups, handleRoleTemplateSelect, selectedRoleTemplates } =
|
||||
useRoleTemplateSelection(toRefs(permissions).permissions);
|
||||
useRoleTemplateSelection(availableRoleTemplates);
|
||||
|
||||
const { copy } = useClipboard({
|
||||
legacy: true,
|
||||
|
|
Loading…
Reference in New Issue