From 848c06e108b153c697fa5444f1474411c84ac33a Mon Sep 17 00:00:00 2001 From: Deepankumar Loganathan Date: Tue, 16 Jan 2024 15:33:19 +0100 Subject: [PATCH] updated changeset with example Signed-off-by: Deepankumar Loganathan --- .changeset/tidy-cooks-mix.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.changeset/tidy-cooks-mix.md b/.changeset/tidy-cooks-mix.md index 41a2220547..97e95331f2 100644 --- a/.changeset/tidy-cooks-mix.md +++ b/.changeset/tidy-cooks-mix.md @@ -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 { + if (isPermission(request.permission, azureSitesActionPermission)) { + return createCatalogConditionalDecision( + request.permission, + catalogConditions.isEntityOwner({ + claims: user?.identity.ownershipEntityRefs ?? [], + }), + ); + } + ... + return { + result: AuthorizeResult.ALLOW, + }; + } + ... + } +```