scaffolder: accessControl to permissions
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
@@ -22,7 +22,7 @@ describe('hasTag', () => {
|
||||
expect(
|
||||
hasTag.apply(
|
||||
{
|
||||
'backstage:accessControl': {
|
||||
'backstage:permissions': {
|
||||
tags: ['foo', 'bar'],
|
||||
},
|
||||
},
|
||||
@@ -33,7 +33,7 @@ describe('hasTag', () => {
|
||||
).toEqual(false);
|
||||
});
|
||||
|
||||
it('returns false when accessControl is missing', () => {
|
||||
it('returns false when backstage:permissions is missing', () => {
|
||||
expect(
|
||||
hasTag.apply(
|
||||
{},
|
||||
@@ -51,7 +51,7 @@ describe('hasTag', () => {
|
||||
apiVersion: 'backstage.io/v1alpha1',
|
||||
kind: 'Component',
|
||||
metadata: {
|
||||
'backstage:accessControl': {
|
||||
'backstage:permissions': {
|
||||
tags: [],
|
||||
},
|
||||
},
|
||||
@@ -67,7 +67,7 @@ describe('hasTag', () => {
|
||||
expect(
|
||||
hasTag.apply(
|
||||
{
|
||||
'backstage:accessControl': {
|
||||
'backstage:permissions': {
|
||||
tags: ['foo', 'bar'],
|
||||
},
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ export const hasTag = createScaffolderPermissionRule({
|
||||
tag: z.string().describe('Name of the tag to match on'),
|
||||
}),
|
||||
apply: (resource, { tag }) => {
|
||||
return resource['backstage:accessControl']?.tags?.includes(tag) ?? false;
|
||||
return resource['backstage:permissions']?.tags?.includes(tag) ?? false;
|
||||
},
|
||||
toQuery: () => ({}),
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ export interface TaskStep {
|
||||
// @public
|
||||
export interface TemplateEntityStepV1beta3 extends JsonObject {
|
||||
// (undocumented)
|
||||
'backstage:accessControl'?: TemplateSpecValuesMetadata;
|
||||
'backstage:permissions'?: TemplateSpecValuesMetadata;
|
||||
// (undocumented)
|
||||
action: string;
|
||||
// (undocumented)
|
||||
@@ -95,7 +95,7 @@ export type TemplateInfo = {
|
||||
// @public
|
||||
export interface TemplateParameter extends JsonObject {
|
||||
// (undocumented)
|
||||
'backstage:accessControl'?: TemplateSpecValuesMetadata;
|
||||
'backstage:permissions'?: TemplateSpecValuesMetadata;
|
||||
// (undocumented)
|
||||
properties?: {
|
||||
[name: string]: JsonObject;
|
||||
|
||||
@@ -78,7 +78,7 @@ export interface TemplateEntityStepV1beta3 extends JsonObject {
|
||||
action: string;
|
||||
input?: JsonObject;
|
||||
if?: string | boolean;
|
||||
'backstage:accessControl'?: TemplateAccessControl;
|
||||
'backstage:permissions'?: TemplatePermissions;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ export interface TemplateEntityStepV1beta3 extends JsonObject {
|
||||
* @public
|
||||
*/
|
||||
export interface TemplateParameter extends JsonObject {
|
||||
'backstage:accessControl'?: TemplateAccessControl;
|
||||
'backstage:permissions'?: TemplatePermissions;
|
||||
properties?: { [name: string]: JsonObject };
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export interface TemplateParameter extends JsonObject {
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface TemplateAccessControl extends JsonObject {
|
||||
export interface TemplatePermissions extends JsonObject {
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
|
||||
@@ -30,5 +30,5 @@ export type {
|
||||
TemplateEntityV1beta3,
|
||||
TemplateEntityStepV1beta3,
|
||||
TemplateParameter,
|
||||
TemplateAccessControl as TemplateSpecValuesMetadata,
|
||||
TemplatePermissions as TemplateSpecValuesMetadata,
|
||||
} from './TemplateEntityV1beta3';
|
||||
|
||||
Reference in New Issue
Block a user