refactor: change role annotations name

change `plugin.halo.run/dependencies` to `rbac.authorization.halo.run/dependencies`
pull/3445/head
Ryan Wang 2022-07-14 18:39:19 +08:00
parent 16cf4d70a1
commit 1f0ea9d168
3 changed files with 10 additions and 10 deletions

View File

@ -142,7 +142,7 @@ async function loadCurrentUser() {
app.provide<User>("currentUser", user);
const { data: permissions } = await apiClient.user.getPermissions(
"ac7cdce1-acf2-4e27-a422-c16d6f47cfa2"
user.metadata.name
);
app.provide("permissions", permissions);
}

View File

@ -38,7 +38,7 @@ const formState = ref<FormState>({
name: "",
labels: {},
annotations: {
"plugin.halo.run/dependencies": "",
"rbac.authorization.halo.run/dependencies": "",
"plugin.halo.run/display-name": "",
},
},
@ -80,7 +80,7 @@ const handleFetchRole = async () => {
);
formState.value.role = response.data;
formState.value.selectedRoleTemplates = JSON.parse(
response.data.metadata.annotations?.["plugin.halo.run/dependencies"] ||
response.data.metadata.annotations?.["rbac.authorization.halo.run/dependencies"] ||
"[]"
);
} catch (error) {
@ -111,7 +111,7 @@ const handleUpdateRole = async () => {
formState.value.saving = true;
if (formState.value.role.metadata.annotations) {
formState.value.role.metadata.annotations[
"plugin.halo.run/dependencies"
"rbac.authorization.halo.run/dependencies"
] = JSON.stringify(formState.value.selectedRoleTemplates);
}
await apiClient.extension.role.updatev1alpha1Role(
@ -319,7 +319,7 @@ onMounted(() => {
<span
v-if="
role.metadata.annotations?.[
'plugin.halo.run/dependencies'
'rbac.authorization.halo.run/dependencies'
]
"
class="text-xs text-gray-400"
@ -328,7 +328,7 @@ onMounted(() => {
{{
JSON.parse(
role.metadata.annotations?.[
"plugin.halo.run/dependencies"
"rbac.authorization.halo.run/dependencies"
]
).join(", ")
}}

View File

@ -34,7 +34,7 @@ const creationFormState = ref<CreationFormState>({
name: "",
labels: {},
annotations: {
"plugin.halo.run/dependencies": "",
"rbac.authorization.halo.run/dependencies": "",
"plugin.halo.run/display-name": "",
}!,
},
@ -83,7 +83,7 @@ const handleCreateRole = async () => {
creationFormState.value.saving = true;
if (creationFormState.value.role.metadata.annotations) {
creationFormState.value.role.metadata.annotations[
"plugin.halo.run/dependencies"
"rbac.authorization.halo.run/dependencies"
] = JSON.stringify(creationFormState.value.selectedRoleTemplates);
}
await apiClient.extension.role.createv1alpha1Role(
@ -181,7 +181,7 @@ watch(
<span
v-if="
role.metadata.annotations?.[
'plugin.halo.run/dependencies'
'rbac.authorization.halo.run/dependencies'
]
"
class="text-xs text-gray-400"
@ -190,7 +190,7 @@ watch(
{{
JSON.parse(
role.metadata.annotations?.[
"plugin.halo.run/dependencies"
"rbac.authorization.halo.run/dependencies"
]
).join(", ")
}}