Create catalog permissions. (#8403)

These permissions will be used to integrate catalog with the permissions framework.

Signed-off-by: Joon Park <joonp@spotify.com>
This commit is contained in:
Joon Park
2021-12-16 14:35:46 +00:00
committed by GitHub
parent 351fc58fe2
commit 393f107893
8 changed files with 251 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-common': minor
---
Create catalog-common and add catalog permissions.
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
extends: [require.resolve('@backstage/cli/config/eslint')],
};
+9
View File
@@ -0,0 +1,9 @@
# Catalog Common
Shared isomorphic code for the catalog plugin.
## Links
- [Frontend part of the plugin](https://github.com/backstage/backstage/tree/master/plugins/catalog)
- [Backend part of the plugin](https://github.com/backstage/backstage/tree/master/plugins/catalog-backend)
- [The Backstage homepage](https://backstage.io)
+31
View File
@@ -0,0 +1,31 @@
## API Report File for "@backstage/plugin-catalog-common"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { Permission } from '@backstage/plugin-permission-common';
// @public
export const catalogEntityDeletePermission: Permission;
// @public
export const catalogEntityReadPermission: Permission;
// @public
export const catalogEntityRefreshPermission: Permission;
// @public
export const catalogLocationCreatePermission: Permission;
// @public
export const catalogLocationDeletePermission: Permission;
// @public
export const catalogLocationReadPermission: Permission;
// @public (undocumented)
export const RESOURCE_TYPE_CATALOG_ENTITY = 'catalog-entity';
// @public (undocumented)
export const RESOURCE_TYPE_CATALOG_LOCATION = 'catalog-location';
```
+41
View File
@@ -0,0 +1,41 @@
{
"name": "@backstage/plugin-catalog-common",
"description": "Common functionalities for the catalog plugin",
"version": "0.0.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"private": false,
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts"
},
"homepage": "https://backstage.io",
"repository": {
"type": "git",
"url": "https://github.com/backstage/backstage",
"directory": "plugins/catalog-common"
},
"keywords": [
"backstage"
],
"scripts": {
"build": "backstage-cli build",
"lint": "backstage-cli lint",
"test": "backstage-cli test --passWithNoTests",
"prepack": "backstage-cli prepack",
"postpack": "backstage-cli postpack",
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/plugin-permission-common": "^0.2.0"
},
"devDependencies": {
"@backstage/cli": "^0.10.0"
},
"files": [
"dist"
]
}
+33
View File
@@ -0,0 +1,33 @@
/*
* Copyright 2021 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.
*/
/**
* Provides shared objects useful for interacting with the catalog and its
* entities, such as catalog permissions.
*
* @packageDocumentation
*/
export {
RESOURCE_TYPE_CATALOG_ENTITY,
RESOURCE_TYPE_CATALOG_LOCATION,
catalogEntityReadPermission,
catalogEntityDeletePermission,
catalogEntityRefreshPermission,
catalogLocationReadPermission,
catalogLocationCreatePermission,
catalogLocationDeletePermission,
} from './permissions';
+113
View File
@@ -0,0 +1,113 @@
/*
* Copyright 2021 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 { Permission } from '@backstage/plugin-permission-common';
/**
* {@link https://backstage.io/docs/features/software-catalog/software-catalog-overview}
* @public
*/
export const RESOURCE_TYPE_CATALOG_ENTITY = 'catalog-entity';
/**
* {@link https://backstage.io/docs/features/software-catalog/descriptor-format#kind-location}
* @public
*/
export const RESOURCE_TYPE_CATALOG_LOCATION = 'catalog-location';
/**
* This permission is used to authorize actions that involve reading one or more
* entities from the catalog.
*
* If this permission is not authorized, it will appear that the entity does not
* exist in the catalog — both in the frontend and in API responses.
* @public
*/
export const catalogEntityReadPermission: Permission = {
name: 'catalog.entity.read',
attributes: {
action: 'read',
},
resourceType: RESOURCE_TYPE_CATALOG_ENTITY,
};
/**
* This permission is used to designate actions that involve removing one or
* more entities from the catalog.
* @public
*/
export const catalogEntityDeletePermission: Permission = {
name: 'catalog.entity.delete',
attributes: {
action: 'delete',
},
resourceType: RESOURCE_TYPE_CATALOG_ENTITY,
};
/**
* This permission is used to designate refreshing one or more entities from the
* catalog.
* @public
*/
export const catalogEntityRefreshPermission: Permission = {
name: 'catalog.entity.refresh',
attributes: {
action: 'update',
},
resourceType: RESOURCE_TYPE_CATALOG_ENTITY,
};
/**
* This permission is used to designate actions that involve reading one or more
* locations from the catalog.
*
* If this permission is not authorized, it will appear that the location does
* not exist in the catalog — both in the frontend and in API responses.
* @public
*/
export const catalogLocationReadPermission: Permission = {
name: 'catalog.location.read',
attributes: {
action: 'read',
},
resourceType: RESOURCE_TYPE_CATALOG_LOCATION,
};
/**
* This permission is used to designate actions that involve creating catalog
* locations.
* @public
*/
export const catalogLocationCreatePermission: Permission = {
name: 'catalog.location.create',
attributes: {
action: 'create',
},
resourceType: RESOURCE_TYPE_CATALOG_LOCATION,
};
/**
* This permission is used to designate actions that involve deleting locations
* from the catalog.
* @public
*/
export const catalogLocationDeletePermission: Permission = {
name: 'catalog.location.delete',
attributes: {
action: 'delete',
},
resourceType: RESOURCE_TYPE_CATALOG_LOCATION,
};
+16
View File
@@ -0,0 +1,16 @@
/*
* Copyright 2021 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.
*/
export {};