set permission backend policies using an extension point

Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Johan Haals <johan.haals@gmail.com>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-04-04 11:45:36 +02:00
parent 0e1f69890e
commit 788f0f5a15
11 changed files with 179 additions and 71 deletions
@@ -0,0 +1,18 @@
## API Report File for "@backstage/plugin-permission-node"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { ExtensionPoint } from '@backstage/backend-plugin-api';
import { PermissionPolicy } from '@backstage/plugin-permission-node';
// @alpha
export type PolicyExtensionPoint = {
setPolicy(policy: PermissionPolicy): void;
};
// @alpha
export const policyExtensionPoint: ExtensionPoint<PolicyExtensionPoint>;
// (No @packageDocumentation comment for this package)
```
+16
View File
@@ -10,6 +10,21 @@
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"alpha": [
"src/alpha.ts"
],
"package.json": [
"package.json"
]
}
},
"backstage": {
"role": "node-library"
},
@@ -34,6 +49,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/plugin-auth-node": "workspace:^",
+17
View File
@@ -0,0 +1,17 @@
/*
* Copyright 2023 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 { type PolicyExtensionPoint, policyExtensionPoint } from './plugin';
+36
View File
@@ -0,0 +1,36 @@
/*
* Copyright 2023 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 { createExtensionPoint } from '@backstage/backend-plugin-api';
import { PermissionPolicy } from '@backstage/plugin-permission-node';
/**
* Allows supplying policies to the permissions backend
*
* @alpha
*/
export type PolicyExtensionPoint = {
setPolicy(policy: PermissionPolicy): void;
};
/**
* Allows supplying policies to the permissions backend
*
* @alpha
*/
export const policyExtensionPoint = createExtensionPoint<PolicyExtensionPoint>({
id: 'permission.policy',
});