diff --git a/plugins/azure-devops-common/src/index.ts b/plugins/azure-devops-common/src/index.ts index 9a4a007317..1dd5d77d51 100644 --- a/plugins/azure-devops-common/src/index.ts +++ b/plugins/azure-devops-common/src/index.ts @@ -16,3 +16,4 @@ export * from './types'; export * from './constants'; +export * from './permissions'; diff --git a/plugins/azure-devops-common/src/permissions.ts b/plugins/azure-devops-common/src/permissions.ts new file mode 100644 index 0000000000..cd42498f07 --- /dev/null +++ b/plugins/azure-devops-common/src/permissions.ts @@ -0,0 +1,53 @@ +/* + * Copyright 2024 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'; + +import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common'; + +export const azureDevOpsPullRequestReadPermission = createPermission({ + name: 'azure.devops.pullrequest.read', + attributes: { action: 'read' }, + resourceType: RESOURCE_TYPE_CATALOG_ENTITY, +}); + +export const azureDevOpsPullRequestDashboardReadPermission = createPermission({ + name: 'azure.devops.pullrequest.dashboard.read', + attributes: { action: 'read' }, +}); + +export const azureDevOpsPipelineReadPermission = createPermission({ + name: 'azure.devops.pipeline.read', + attributes: { action: 'read' }, + resourceType: RESOURCE_TYPE_CATALOG_ENTITY, +}); +export const azureDevOpsGitTagReadPermission = createPermission({ + name: 'azure.devops.gittag.read', + attributes: { action: 'read' }, + resourceType: RESOURCE_TYPE_CATALOG_ENTITY, +}); +export const azureDevOpsReadmeReadPermission = createPermission({ + name: 'azure.devops.readme.read', + attributes: { action: 'read' }, + resourceType: RESOURCE_TYPE_CATALOG_ENTITY, +}); + +export const azureDevOpsPermissions = [ + azureDevOpsPullRequestReadPermission, + azureDevOpsPipelineReadPermission, + azureDevOpsGitTagReadPermission, + azureDevOpsReadmeReadPermission, + azureDevOpsPullRequestDashboardReadPermission, +]; diff --git a/plugins/azure-devops-common/src/types.ts b/plugins/azure-devops-common/src/types.ts index 0390bb1f6e..ab53af66cb 100644 --- a/plugins/azure-devops-common/src/types.ts +++ b/plugins/azure-devops-common/src/types.ts @@ -210,6 +210,7 @@ export interface Team { export interface ReadmeConfig { project: string; repo: string; + entityRef: string; host?: string; org?: string; path?: string;