updated changeset with example
Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>
This commit is contained in:
committed by
blam
parent
a0b718b398
commit
848c06e108
@@ -4,4 +4,29 @@
|
||||
'@backstage/plugin-azure-sites': minor
|
||||
---
|
||||
|
||||
Implemented Permission framework to protect start and stop `Azure sites`.
|
||||
`Azure Site` Start and Stop action is now protected with `Permission framework`. Also `catalogApi` is required in `createRouter` when adding this plugin.
|
||||
|
||||
The below example illustrate that the action is forbids anyone but the owner of the catalog entity to trigger actions towards a site tied to an entity.
|
||||
|
||||
```typescript
|
||||
// packages/backend/src/plugins/permission.ts
|
||||
import { azureSitesActionPermission } from '@backstage/plugin-azure-sites-common';
|
||||
...
|
||||
class TestPermissionPolicy implements PermissionPolicy {
|
||||
async handle(request: PolicyQuery, user?: BackstageIdentityResponse): Promise<PolicyDecision> {
|
||||
if (isPermission(request.permission, azureSitesActionPermission)) {
|
||||
return createCatalogConditionalDecision(
|
||||
request.permission,
|
||||
catalogConditions.isEntityOwner({
|
||||
claims: user?.identity.ownershipEntityRefs ?? [],
|
||||
}),
|
||||
);
|
||||
}
|
||||
...
|
||||
return {
|
||||
result: AuthorizeResult.ALLOW,
|
||||
};
|
||||
}
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user