scaffolder: add permissions

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2023-01-11 11:17:50 +01:00
parent cc47161fe3
commit 6f8b6c7069
3 changed files with 31 additions and 0 deletions
+1
View File
@@ -39,6 +39,7 @@
},
"dependencies": {
"@backstage/catalog-model": "workspace:^",
"@backstage/plugin-permission-common": "workspace:^",
"@backstage/types": "workspace:^"
},
"devDependencies": {
+1
View File
@@ -25,4 +25,5 @@ export {
templateEntityV1beta3Validator,
isTemplateEntityV1beta3,
} from './TemplateEntityV1beta3';
export * from './permissions';
export type { TemplateEntityV1beta3 } from './TemplateEntityV1beta3';
@@ -0,0 +1,29 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createPermission } from '@backstage/plugin-permission-common';
export const RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = 'scaffolder-field';
export const templateSchemaExecutePermission = createPermission({
name: 'scaffolder.template.schema.execute',
attributes: {
action: 'create',
},
resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,
});
export const scaffolderPermissions = [templateSchemaExecutePermission];