mirror of https://github.com/rancher/dashboard.git
Merge pull request #3448 from codyrancher/cluster-members-is-sytstem
Updating how we check if a cluster/projectRoleTemplateBinding isSystem
This commit is contained in:
commit
8760c8da7f
|
|
@ -52,11 +52,12 @@ export default {
|
||||||
];
|
];
|
||||||
const allBindings = this.schema ? await this.$store.dispatch(`management/findAll`, { type: this.type }) : [];
|
const allBindings = this.schema ? await this.$store.dispatch(`management/findAll`, { type: this.type }) : [];
|
||||||
const bindings = allBindings
|
const bindings = allBindings
|
||||||
|
.filter(b => !b.isSystem)
|
||||||
.filter(b => !b.user?.isSystem)
|
.filter(b => !b.user?.isSystem)
|
||||||
.filter(b => normalizeId(get(b, this.parentKey)) === normalizeId(this.parentId));
|
.filter(b => normalizeId(get(b, this.parentKey)) === normalizeId(this.parentId));
|
||||||
|
|
||||||
// Add the current user as the project owner. This will get created by default
|
// Add the current user as the project owner. This will get created by default
|
||||||
if (bindings.length === 0 && this.defaultBindingHandler) {
|
if (this.mode === _CREATE && bindings.length === 0 && this.defaultBindingHandler) {
|
||||||
bindings.push(await this.defaultBindingHandler());
|
bindings.push(await this.defaultBindingHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ export const CATTLE_PUBLIC_ENDPOINTS = 'field.cattle.io/publicEndpoints';
|
||||||
export const TARGET_WORKLOADS = 'field.cattle.io/targetWorkloadIds';
|
export const TARGET_WORKLOADS = 'field.cattle.io/targetWorkloadIds';
|
||||||
export const UI_MANAGED = 'management.cattle.io/ui-managed';
|
export const UI_MANAGED = 'management.cattle.io/ui-managed';
|
||||||
export const CREATOR_ID = 'field.cattle.io/creatorId';
|
export const CREATOR_ID = 'field.cattle.io/creatorId';
|
||||||
export const CREATOR_OWNER_BINDING = 'authz.management.cattle.io/creator-owner-binding';
|
|
||||||
|
|
||||||
export const KUBERNETES = {
|
export const KUBERNETES = {
|
||||||
SERVICE_ACCOUNT_UID: 'kubernetes.io/service-account.uid',
|
SERVICE_ACCOUNT_UID: 'kubernetes.io/service-account.uid',
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { CREATOR_ID, CREATOR_OWNER_BINDING } from '@/config/labels-annotations';
|
import { CREATOR_ID } from '@/config/labels-annotations';
|
||||||
import { _CREATE } from '@/config/query-params';
|
import { _CREATE } from '@/config/query-params';
|
||||||
import { MANAGEMENT, NORMAN } from '@/config/types';
|
import { MANAGEMENT, NORMAN } from '@/config/types';
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
isSystem() {
|
isSystem() {
|
||||||
return !this.metadata.annotations[CREATOR_ID] && this.metadata.annotations[CREATOR_OWNER_BINDING] !== 'true';
|
return !this.metadata.annotations[CREATOR_ID];
|
||||||
},
|
},
|
||||||
|
|
||||||
norman() {
|
norman() {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { CREATOR_ID } from '@/config/labels-annotations';
|
||||||
import { MANAGEMENT, NORMAN } from '@/config/types';
|
import { MANAGEMENT, NORMAN } from '@/config/types';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -99,6 +100,10 @@ export default {
|
||||||
return { name: 'c-cluster-explorer-project-members' };
|
return { name: 'c-cluster-explorer-project-members' };
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isSystem() {
|
||||||
|
return !this.metadata.annotations[CREATOR_ID];
|
||||||
|
},
|
||||||
|
|
||||||
norman() {
|
norman() {
|
||||||
return this.$dispatch(`rancher/create`, {
|
return this.$dispatch(`rancher/create`, {
|
||||||
type: NORMAN.PROJECT_ROLE_TEMPLATE_BINDING,
|
type: NORMAN.PROJECT_ROLE_TEMPLATE_BINDING,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue