@drodil/backstage-plugin-qeta-node 3.59.1 → 3.59.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conditionExports.cjs.js.map +1 -1
- package/dist/defaultPermissionPolicy.cjs.js +1 -0
- package/dist/defaultPermissionPolicy.cjs.js.map +1 -1
- package/dist/extensions.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/permissionResources.cjs.js.map +1 -1
- package/dist/permissionRules.cjs.js +65 -65
- package/dist/permissionRules.cjs.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditionExports.cjs.js","sources":["../src/conditionExports.ts"],"sourcesContent":["import { createConditionExports } from '@backstage/plugin-permission-node';\nimport {\n answerRules,\n collectionRules,\n commentRules,\n postRules,\n tagRules,\n} from './permissionRules';\nimport {\n answerPermissionResourceRef,\n collectionPermissionResourceRef,\n commentPermissionResourceRef,\n postPermissionResourceRef,\n tagPermissionResourceRef,\n} from './permissionResources.ts';\n\nconst {\n conditions: qConditions,\n createConditionalDecision: createPostDecision,\n} = createConditionExports({\n resourceRef: postPermissionResourceRef,\n rules: postRules,\n});\n\nexport const questionConditions = qConditions;\n\nexport const createPostConditionalDecision = createPostDecision;\n\nconst {\n conditions: aConditions,\n createConditionalDecision: createAnswerDecision,\n} = createConditionExports({\n resourceRef: answerPermissionResourceRef,\n rules: answerRules,\n});\n\nexport const answerConditions = aConditions;\n\nexport const createAnswerConditionalDecision = createAnswerDecision;\n\nconst {\n conditions: cConditions,\n createConditionalDecision: createCommentDecision,\n} = createConditionExports({\n resourceRef: commentPermissionResourceRef,\n rules: commentRules,\n});\n\nexport const commentConditions = cConditions;\n\nexport const createCommentConditionalDecision = createCommentDecision;\n\nconst {\n conditions: tConditions,\n createConditionalDecision: createTagDecision,\n} = createConditionExports({\n resourceRef: tagPermissionResourceRef,\n rules: tagRules,\n});\n\nexport const tagConditions = tConditions;\n\nexport const createTagConditionalDecision = createTagDecision;\n\nconst {\n conditions: colConditions,\n createConditionalDecision: createCollectionDecision,\n} = createConditionExports({\n resourceRef: collectionPermissionResourceRef,\n rules: collectionRules,\n});\n\nexport const collectionConditions = colConditions;\n\nexport const createCollectionConditionalDecision = createCollectionDecision;\n"],"names":["createConditionExports","postPermissionResourceRef","postRules","answerPermissionResourceRef","answerRules","commentPermissionResourceRef","commentRules","tagPermissionResourceRef","tagRules","collectionPermissionResourceRef","collectionRules"],"mappings":";;;;;;AAgBA,MAAM;AAAA,EACJ,
|
|
1
|
+
{"version":3,"file":"conditionExports.cjs.js","sources":["../src/conditionExports.ts"],"sourcesContent":["import { createConditionExports } from '@backstage/plugin-permission-node';\nimport {\n answerRules,\n collectionRules,\n commentRules,\n postRules,\n tagRules,\n} from './permissionRules';\nimport {\n answerPermissionResourceRef,\n collectionPermissionResourceRef,\n commentPermissionResourceRef,\n postPermissionResourceRef,\n tagPermissionResourceRef,\n} from './permissionResources.ts';\n\nconst {\n conditions: qConditions,\n createConditionalDecision: createPostDecision,\n} = createConditionExports({\n resourceRef: postPermissionResourceRef,\n rules: postRules,\n});\n\nexport const questionConditions = qConditions;\n\nexport const createPostConditionalDecision = createPostDecision;\n\nconst {\n conditions: aConditions,\n createConditionalDecision: createAnswerDecision,\n} = createConditionExports({\n resourceRef: answerPermissionResourceRef,\n rules: answerRules,\n});\n\nexport const answerConditions = aConditions;\n\nexport const createAnswerConditionalDecision = createAnswerDecision;\n\nconst {\n conditions: cConditions,\n createConditionalDecision: createCommentDecision,\n} = createConditionExports({\n resourceRef: commentPermissionResourceRef,\n rules: commentRules,\n});\n\nexport const commentConditions = cConditions;\n\nexport const createCommentConditionalDecision = createCommentDecision;\n\nconst {\n conditions: tConditions,\n createConditionalDecision: createTagDecision,\n} = createConditionExports({\n resourceRef: tagPermissionResourceRef,\n rules: tagRules,\n});\n\nexport const tagConditions = tConditions;\n\nexport const createTagConditionalDecision = createTagDecision;\n\nconst {\n conditions: colConditions,\n createConditionalDecision: createCollectionDecision,\n} = createConditionExports({\n resourceRef: collectionPermissionResourceRef,\n rules: collectionRules,\n});\n\nexport const collectionConditions = colConditions;\n\nexport const createCollectionConditionalDecision = createCollectionDecision;\n"],"names":["createConditionExports","postPermissionResourceRef","postRules","answerPermissionResourceRef","answerRules","commentPermissionResourceRef","commentRules","tagPermissionResourceRef","tagRules","collectionPermissionResourceRef","collectionRules"],"mappings":";;;;;;AAgBA,MAAM;AAAA,EACJ,UAAA,EAAY,WAAA;AAAA,EACZ,yBAAA,EAA2B;AAC7B,CAAA,GAAIA,2CAAA,CAAuB;AAAA,EACzB,WAAA,EAAaC,6CAAA;AAAA,EACb,KAAA,EAAOC;AACT,CAAC,CAAA;AAEM,MAAM,kBAAA,GAAqB;AAE3B,MAAM,6BAAA,GAAgC;AAE7C,MAAM;AAAA,EACJ,UAAA,EAAY,WAAA;AAAA,EACZ,yBAAA,EAA2B;AAC7B,CAAA,GAAIF,2CAAA,CAAuB;AAAA,EACzB,WAAA,EAAaG,+CAAA;AAAA,EACb,KAAA,EAAOC;AACT,CAAC,CAAA;AAEM,MAAM,gBAAA,GAAmB;AAEzB,MAAM,+BAAA,GAAkC;AAE/C,MAAM;AAAA,EACJ,UAAA,EAAY,WAAA;AAAA,EACZ,yBAAA,EAA2B;AAC7B,CAAA,GAAIJ,2CAAA,CAAuB;AAAA,EACzB,WAAA,EAAaK,gDAAA;AAAA,EACb,KAAA,EAAOC;AACT,CAAC,CAAA;AAEM,MAAM,iBAAA,GAAoB;AAE1B,MAAM,gCAAA,GAAmC;AAEhD,MAAM;AAAA,EACJ,UAAA,EAAY,WAAA;AAAA,EACZ,yBAAA,EAA2B;AAC7B,CAAA,GAAIN,2CAAA,CAAuB;AAAA,EACzB,WAAA,EAAaO,4CAAA;AAAA,EACb,KAAA,EAAOC;AACT,CAAC,CAAA;AAEM,MAAM,aAAA,GAAgB;AAEtB,MAAM,4BAAA,GAA+B;AAE5C,MAAM;AAAA,EACJ,UAAA,EAAY,aAAA;AAAA,EACZ,yBAAA,EAA2B;AAC7B,CAAA,GAAIR,2CAAA,CAAuB;AAAA,EACzB,WAAA,EAAaS,mDAAA;AAAA,EACb,KAAA,EAAOC;AACT,CAAC,CAAA;AAEM,MAAM,oBAAA,GAAuB;AAE7B,MAAM,mCAAA,GAAsC;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultPermissionPolicy.cjs.js","sources":["../src/defaultPermissionPolicy.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: Copyright 2024 OP Financial Group (https://op.fi). All Rights Reserved.\n * SPDX-License-Identifier: LicenseRef-OpAllRightsReserved\n */\nimport { BackstageIdentityResponse } from '@backstage/plugin-auth-node';\nimport {\n AuthorizeResult,\n isPermission,\n isResourcePermission,\n isUpdatePermission,\n PolicyDecision,\n} from '@backstage/plugin-permission-common';\nimport {\n PermissionPolicy,\n PolicyQuery,\n} from '@backstage/plugin-permission-node';\nimport {\n ANSWER_RESOURCE_TYPE,\n COLLECTION_RESOUCE_TYPE,\n COMMENT_RESOURCE_TYPE,\n POST_RESOURCE_TYPE,\n qetaCreatePostReviewPermission,\n qetaDeletePostReviewPermission,\n qetaReadPostReviewPermission,\n TAG_RESOURCE_TYPE,\n} from '@drodil/backstage-plugin-qeta-common';\nimport {\n answerAuthorConditionFactory,\n answerTagExpertConditionFactory,\n collectionOwnerConditionFactory,\n collectionTagExpertConditionFactory,\n commentAuthorConditionFactory,\n createAnswerConditionalDecision,\n createCollectionConditionalDecision,\n createCommentConditionalDecision,\n createPostConditionalDecision,\n postAuthorConditionFactory,\n postTagExpertConditionFactory,\n} from '@drodil/backstage-plugin-qeta-node';\nimport { Config } from '@backstage/config';\n\nexport class DefaultQetaPermissionPolicy implements PermissionPolicy {\n constructor(private readonly config?: Config) {}\n\n async handle(\n request: PolicyQuery,\n user?: BackstageIdentityResponse,\n ): Promise<PolicyDecision> {\n // We cannot do anything without a user\n if (!user) {\n return { result: AuthorizeResult.DENY };\n }\n\n // Moderators can modify anything\n const moderators =\n this.config?.getOptionalStringArray('qeta.moderators') ?? [];\n if (\n moderators.includes(user.identity.userEntityRef) ||\n user.identity.ownershipEntityRefs.some(ref => moderators.includes(ref))\n ) {\n return { result: AuthorizeResult.ALLOW };\n }\n\n if (\n isPermission(request.permission, qetaReadPostReviewPermission) ||\n isPermission(request.permission, qetaCreatePostReviewPermission) ||\n isPermission(request.permission, qetaDeletePostReviewPermission)\n ) {\n return { result: AuthorizeResult.DENY };\n }\n\n if (\n request.permission.attributes.action === 'create' ||\n request.permission.attributes.action === 'read'\n ) {\n return { result: AuthorizeResult.ALLOW };\n }\n\n if (\n request.permission.attributes.action === 'update' ||\n request.permission.attributes.action === 'delete'\n ) {\n if (isResourcePermission(request.permission, POST_RESOURCE_TYPE)) {\n return createPostConditionalDecision(request.permission, {\n anyOf: [\n // Can edit and delete own questions\n postAuthorConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n // Can edit and delete if tag expert\n postTagExpertConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n ],\n });\n }\n\n if (isResourcePermission(request.permission, ANSWER_RESOURCE_TYPE)) {\n return createAnswerConditionalDecision(request.permission, {\n anyOf: [\n answerAuthorConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n answerTagExpertConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n ],\n });\n }\n\n // Allow deleting and updating only own comments\n if (isResourcePermission(request.permission, COMMENT_RESOURCE_TYPE)) {\n return createCommentConditionalDecision(request.permission, {\n allOf: [\n commentAuthorConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n ],\n });\n }\n\n if (isResourcePermission(request.permission, COLLECTION_RESOUCE_TYPE)) {\n return createCollectionConditionalDecision(request.permission, {\n anyOf: [\n // Allow deleting and updating only own collections\n collectionOwnerConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n // Allow deleting and updating if tag expert\n collectionTagExpertConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n ],\n });\n }\n\n // Allow updating any tag by anyone\n if (\n isResourcePermission(request.permission, TAG_RESOURCE_TYPE) &&\n isUpdatePermission(request.permission)\n ) {\n return { result: AuthorizeResult.ALLOW };\n }\n }\n\n return { result: AuthorizeResult.DENY };\n }\n}\n"],"names":["AuthorizeResult","isPermission","qetaReadPostReviewPermission","qetaCreatePostReviewPermission","qetaDeletePostReviewPermission","isResourcePermission","POST_RESOURCE_TYPE","createPostConditionalDecision","postAuthorConditionFactory","postTagExpertConditionFactory","ANSWER_RESOURCE_TYPE","createAnswerConditionalDecision","answerAuthorConditionFactory","answerTagExpertConditionFactory","COMMENT_RESOURCE_TYPE","createCommentConditionalDecision","commentAuthorConditionFactory","COLLECTION_RESOUCE_TYPE","createCollectionConditionalDecision","collectionOwnerConditionFactory","collectionTagExpertConditionFactory","TAG_RESOURCE_TYPE","isUpdatePermission"],"mappings":";;;;;;AAyCO,MAAM,
|
|
1
|
+
{"version":3,"file":"defaultPermissionPolicy.cjs.js","sources":["../src/defaultPermissionPolicy.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: Copyright 2024 OP Financial Group (https://op.fi). All Rights Reserved.\n * SPDX-License-Identifier: LicenseRef-OpAllRightsReserved\n */\nimport { BackstageIdentityResponse } from '@backstage/plugin-auth-node';\nimport {\n AuthorizeResult,\n isPermission,\n isResourcePermission,\n isUpdatePermission,\n PolicyDecision,\n} from '@backstage/plugin-permission-common';\nimport {\n PermissionPolicy,\n PolicyQuery,\n} from '@backstage/plugin-permission-node';\nimport {\n ANSWER_RESOURCE_TYPE,\n COLLECTION_RESOUCE_TYPE,\n COMMENT_RESOURCE_TYPE,\n POST_RESOURCE_TYPE,\n qetaCreatePostReviewPermission,\n qetaDeletePostReviewPermission,\n qetaReadPostReviewPermission,\n TAG_RESOURCE_TYPE,\n} from '@drodil/backstage-plugin-qeta-common';\nimport {\n answerAuthorConditionFactory,\n answerTagExpertConditionFactory,\n collectionOwnerConditionFactory,\n collectionTagExpertConditionFactory,\n commentAuthorConditionFactory,\n createAnswerConditionalDecision,\n createCollectionConditionalDecision,\n createCommentConditionalDecision,\n createPostConditionalDecision,\n postAuthorConditionFactory,\n postTagExpertConditionFactory,\n} from '@drodil/backstage-plugin-qeta-node';\nimport { Config } from '@backstage/config';\n\nexport class DefaultQetaPermissionPolicy implements PermissionPolicy {\n constructor(private readonly config?: Config) {}\n\n async handle(\n request: PolicyQuery,\n user?: BackstageIdentityResponse,\n ): Promise<PolicyDecision> {\n // We cannot do anything without a user\n if (!user) {\n return { result: AuthorizeResult.DENY };\n }\n\n // Moderators can modify anything\n const moderators =\n this.config?.getOptionalStringArray('qeta.moderators') ?? [];\n if (\n moderators.includes(user.identity.userEntityRef) ||\n user.identity.ownershipEntityRefs.some(ref => moderators.includes(ref))\n ) {\n return { result: AuthorizeResult.ALLOW };\n }\n\n if (\n isPermission(request.permission, qetaReadPostReviewPermission) ||\n isPermission(request.permission, qetaCreatePostReviewPermission) ||\n isPermission(request.permission, qetaDeletePostReviewPermission)\n ) {\n return { result: AuthorizeResult.DENY };\n }\n\n if (\n request.permission.attributes.action === 'create' ||\n request.permission.attributes.action === 'read'\n ) {\n return { result: AuthorizeResult.ALLOW };\n }\n\n if (\n request.permission.attributes.action === 'update' ||\n request.permission.attributes.action === 'delete'\n ) {\n if (isResourcePermission(request.permission, POST_RESOURCE_TYPE)) {\n return createPostConditionalDecision(request.permission, {\n anyOf: [\n // Can edit and delete own questions\n postAuthorConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n // Can edit and delete if tag expert\n postTagExpertConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n ],\n });\n }\n\n if (isResourcePermission(request.permission, ANSWER_RESOURCE_TYPE)) {\n return createAnswerConditionalDecision(request.permission, {\n anyOf: [\n answerAuthorConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n answerTagExpertConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n ],\n });\n }\n\n // Allow deleting and updating only own comments\n if (isResourcePermission(request.permission, COMMENT_RESOURCE_TYPE)) {\n return createCommentConditionalDecision(request.permission, {\n allOf: [\n commentAuthorConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n ],\n });\n }\n\n if (isResourcePermission(request.permission, COLLECTION_RESOUCE_TYPE)) {\n return createCollectionConditionalDecision(request.permission, {\n anyOf: [\n // Allow deleting and updating only own collections\n collectionOwnerConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n // Allow deleting and updating if tag expert\n collectionTagExpertConditionFactory({\n userRef: user.identity.userEntityRef,\n }),\n ],\n });\n }\n\n // Allow updating any tag by anyone\n if (\n isResourcePermission(request.permission, TAG_RESOURCE_TYPE) &&\n isUpdatePermission(request.permission)\n ) {\n return { result: AuthorizeResult.ALLOW };\n }\n }\n\n return { result: AuthorizeResult.DENY };\n }\n}\n"],"names":["AuthorizeResult","isPermission","qetaReadPostReviewPermission","qetaCreatePostReviewPermission","qetaDeletePostReviewPermission","isResourcePermission","POST_RESOURCE_TYPE","createPostConditionalDecision","postAuthorConditionFactory","postTagExpertConditionFactory","ANSWER_RESOURCE_TYPE","createAnswerConditionalDecision","answerAuthorConditionFactory","answerTagExpertConditionFactory","COMMENT_RESOURCE_TYPE","createCommentConditionalDecision","commentAuthorConditionFactory","COLLECTION_RESOUCE_TYPE","createCollectionConditionalDecision","collectionOwnerConditionFactory","collectionTagExpertConditionFactory","TAG_RESOURCE_TYPE","isUpdatePermission"],"mappings":";;;;;;AAyCO,MAAM,2BAAA,CAAwD;AAAA,EACnE,YAA6B,MAAA,EAAiB;AAAjB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAAkB;AAAA,EAAlB,MAAA;AAAA,EAE7B,MAAM,MAAA,CACJ,OAAA,EACA,IAAA,EACyB;AAEzB,IAAA,IAAI,CAAC,IAAA,EAAM;AACT,MAAA,OAAO,EAAE,MAAA,EAAQA,sCAAA,CAAgB,IAAA,EAAK;AAAA,IACxC;AAGA,IAAA,MAAM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,EAAQtB,sCAAA,CAAgB,KAAA,EAAM;AAAA,MACzC;AAAA,IACF;AAEA,IAAA,OAAO,EAAE,MAAA,EAAQA,sCAAA,CAAgB,IAAA,EAAK;AAAA,EACxC;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.cjs.js","sources":["../src/extensions.ts"],"sourcesContent":["import {\n BackstageCredentials,\n BackstageUserPrincipal,\n createExtensionPoint,\n} from '@backstage/backend-plugin-api';\nimport {\n AIResponse,\n Answer,\n Article,\n Badge,\n Collection,\n Post,\n QetaIdEntity,\n Question,\n UserResponse,\n} from '@drodil/backstage-plugin-qeta-common';\n\nexport interface AIHandler {\n /**\n * Answer question that has already been posted in the question page\n */\n answerExistingQuestion?(\n question: Question,\n options?: { credentials?: BackstageCredentials<BackstageUserPrincipal> },\n ): Promise<AIResponse>;\n\n /**\n * Answer a draft question in the Ask a question page\n */\n answerNewQuestion?(\n title: string,\n content: string,\n options?: { credentials?: BackstageCredentials<BackstageUserPrincipal> },\n ): Promise<AIResponse>;\n\n /**\n * Summarize article\n */\n summarizeArticle?(\n article: Article,\n options?: { credentials?: BackstageCredentials<BackstageUserPrincipal> },\n ): Promise<AIResponse>;\n\n /**\n * Suggest tags based on post title and content\n */\n suggestTags?(\n title: string,\n content: string,\n options?: { credentials?: BackstageCredentials<BackstageUserPrincipal> },\n ): Promise<{ tags: string[] }>;\n\n /**\n * Check if answering existing questions is enabled for specific credentials. Defaults to true.\n * Must also implement the `answerExistingQuestion` method.\n */\n isExistingQuestionEnabled?(options?: {\n credentials?: BackstageCredentials;\n }): Promise<boolean>;\n\n /**\n * Check if answering new questions is enabled for specific credentials. Defaults to true.\n * Must also implement the `answerNewQuestion` method.\n */\n isNewQuestionEnabled?(options?: {\n credentials?: BackstageCredentials;\n }): Promise<boolean>;\n\n /**\n * Check if article summarization is enabled for specific credentials. Defaults to true.\n * Must also implement the `summarizeArticle` method.\n */\n isArticleSummarizationEnabled?(options?: {\n credentials?: BackstageCredentials;\n }): Promise<boolean>;\n}\n\nexport interface QetaAIExtensionPoint {\n setAIHandler(handler: AIHandler): void;\n}\n\nexport interface TagDatabase {\n /**\n * Get custom tag descriptions that are updated to the plugin.\n * The format is {`tag name`: `tag description`}.\n */\n getTags(): Promise<Record<string, string>>;\n}\n\nexport interface QetaTagDatabaseExtensionPoint {\n setTagDatabase(tagDatabase: TagDatabase): void;\n}\n\nexport const qetaAIExtensionPoint = createExtensionPoint<QetaAIExtensionPoint>({\n id: 'qeta.ai',\n});\n\nexport const qetaTagDatabaseExtensionPoint =\n createExtensionPoint<QetaTagDatabaseExtensionPoint>({\n id: 'qeta.tags',\n });\n\nexport interface NotificationReceiversHandler {\n onNewPost?(post: Post): Promise<string[]>;\n onNewPostComment?(post: Post): Promise<string[]>;\n onPostDelete?(post: Post): Promise<string[]>;\n onCollectionDelete?(collection: Collection): Promise<string[]>;\n onAnswerDelete?(post: Post, answer: Answer): Promise<string[]>;\n onPostEdit?(post: Post): Promise<string[]>;\n onNewAnswer?(post: Post, answer: Answer): Promise<string[]>;\n onAnswerComment?(post: Post, answer: Answer): Promise<string[]>;\n onCorrectAnswer?(post: Post, answer: Answer): Promise<string[]>;\n onMention?(post: Post | Answer): Promise<string[]>;\n onNewCollection?(collection: Collection): Promise<string[]>;\n onNewPostToCollection?(collection: Collection): Promise<string[]>;\n}\n\nexport interface QetaNotificationReceiversExtensionPoint {\n setHandler(handler: NotificationReceiversHandler): void;\n}\n\nexport const qetaNotificationReceiversExtensionPoint =\n createExtensionPoint<QetaNotificationReceiversExtensionPoint>({\n id: 'qeta.notifications',\n });\n\nexport interface BadgeEvaluator extends Omit<Badge, 'id'> {\n evaluate?(entity: QetaIdEntity): Promise<boolean>;\n\n evaluateCollection?(entities: QetaIdEntity[]): Promise<boolean>;\n\n evaluateUser?(user: UserResponse): Promise<boolean>;\n}\n\nexport interface QetaBadgeEvaluatorExtensionPoint {\n addEvaluator(evaluator: BadgeEvaluator): void;\n}\n\nexport const qetaBadgeEvaluatorExtensionPoint =\n createExtensionPoint<QetaBadgeEvaluatorExtensionPoint>({\n id: 'qeta.badges',\n });\n"],"names":["createExtensionPoint"],"mappings":";;;;AA6FO,MAAM,uBAAuBA,
|
|
1
|
+
{"version":3,"file":"extensions.cjs.js","sources":["../src/extensions.ts"],"sourcesContent":["import {\n BackstageCredentials,\n BackstageUserPrincipal,\n createExtensionPoint,\n} from '@backstage/backend-plugin-api';\nimport {\n AIResponse,\n Answer,\n Article,\n Badge,\n Collection,\n Post,\n QetaIdEntity,\n Question,\n UserResponse,\n} from '@drodil/backstage-plugin-qeta-common';\n\nexport interface AIHandler {\n /**\n * Answer question that has already been posted in the question page\n */\n answerExistingQuestion?(\n question: Question,\n options?: { credentials?: BackstageCredentials<BackstageUserPrincipal> },\n ): Promise<AIResponse>;\n\n /**\n * Answer a draft question in the Ask a question page\n */\n answerNewQuestion?(\n title: string,\n content: string,\n options?: { credentials?: BackstageCredentials<BackstageUserPrincipal> },\n ): Promise<AIResponse>;\n\n /**\n * Summarize article\n */\n summarizeArticle?(\n article: Article,\n options?: { credentials?: BackstageCredentials<BackstageUserPrincipal> },\n ): Promise<AIResponse>;\n\n /**\n * Suggest tags based on post title and content\n */\n suggestTags?(\n title: string,\n content: string,\n options?: { credentials?: BackstageCredentials<BackstageUserPrincipal> },\n ): Promise<{ tags: string[] }>;\n\n /**\n * Check if answering existing questions is enabled for specific credentials. Defaults to true.\n * Must also implement the `answerExistingQuestion` method.\n */\n isExistingQuestionEnabled?(options?: {\n credentials?: BackstageCredentials;\n }): Promise<boolean>;\n\n /**\n * Check if answering new questions is enabled for specific credentials. Defaults to true.\n * Must also implement the `answerNewQuestion` method.\n */\n isNewQuestionEnabled?(options?: {\n credentials?: BackstageCredentials;\n }): Promise<boolean>;\n\n /**\n * Check if article summarization is enabled for specific credentials. Defaults to true.\n * Must also implement the `summarizeArticle` method.\n */\n isArticleSummarizationEnabled?(options?: {\n credentials?: BackstageCredentials;\n }): Promise<boolean>;\n}\n\nexport interface QetaAIExtensionPoint {\n setAIHandler(handler: AIHandler): void;\n}\n\nexport interface TagDatabase {\n /**\n * Get custom tag descriptions that are updated to the plugin.\n * The format is {`tag name`: `tag description`}.\n */\n getTags(): Promise<Record<string, string>>;\n}\n\nexport interface QetaTagDatabaseExtensionPoint {\n setTagDatabase(tagDatabase: TagDatabase): void;\n}\n\nexport const qetaAIExtensionPoint = createExtensionPoint<QetaAIExtensionPoint>({\n id: 'qeta.ai',\n});\n\nexport const qetaTagDatabaseExtensionPoint =\n createExtensionPoint<QetaTagDatabaseExtensionPoint>({\n id: 'qeta.tags',\n });\n\nexport interface NotificationReceiversHandler {\n onNewPost?(post: Post): Promise<string[]>;\n onNewPostComment?(post: Post): Promise<string[]>;\n onPostDelete?(post: Post): Promise<string[]>;\n onCollectionDelete?(collection: Collection): Promise<string[]>;\n onAnswerDelete?(post: Post, answer: Answer): Promise<string[]>;\n onPostEdit?(post: Post): Promise<string[]>;\n onNewAnswer?(post: Post, answer: Answer): Promise<string[]>;\n onAnswerComment?(post: Post, answer: Answer): Promise<string[]>;\n onCorrectAnswer?(post: Post, answer: Answer): Promise<string[]>;\n onMention?(post: Post | Answer): Promise<string[]>;\n onNewCollection?(collection: Collection): Promise<string[]>;\n onNewPostToCollection?(collection: Collection): Promise<string[]>;\n}\n\nexport interface QetaNotificationReceiversExtensionPoint {\n setHandler(handler: NotificationReceiversHandler): void;\n}\n\nexport const qetaNotificationReceiversExtensionPoint =\n createExtensionPoint<QetaNotificationReceiversExtensionPoint>({\n id: 'qeta.notifications',\n });\n\nexport interface BadgeEvaluator extends Omit<Badge, 'id'> {\n evaluate?(entity: QetaIdEntity): Promise<boolean>;\n\n evaluateCollection?(entities: QetaIdEntity[]): Promise<boolean>;\n\n evaluateUser?(user: UserResponse): Promise<boolean>;\n}\n\nexport interface QetaBadgeEvaluatorExtensionPoint {\n addEvaluator(evaluator: BadgeEvaluator): void;\n}\n\nexport const qetaBadgeEvaluatorExtensionPoint =\n createExtensionPoint<QetaBadgeEvaluatorExtensionPoint>({\n id: 'qeta.badges',\n });\n"],"names":["createExtensionPoint"],"mappings":";;;;AA6FO,MAAM,uBAAuBA,qCAAA,CAA2C;AAAA,EAC7E,EAAA,EAAI;AACN,CAAC;AAEM,MAAM,gCACXA,qCAAA,CAAoD;AAAA,EAClD,EAAA,EAAI;AACN,CAAC;AAqBI,MAAM,0CACXA,qCAAA,CAA8D;AAAA,EAC5D,EAAA,EAAI;AACN,CAAC;AAcI,MAAM,mCACXA,qCAAA,CAAuD;AAAA,EACrD,EAAA,EAAI;AACN,CAAC;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
2
|
import { BackstageCredentials, BackstageUserPrincipal } from '@backstage/backend-plugin-api';
|
|
3
3
|
import * as _drodil_backstage_plugin_qeta_common from '@drodil/backstage-plugin-qeta-common';
|
|
4
|
-
import { Question, AIResponse, Article,
|
|
4
|
+
import { Question, AIResponse, Article, Badge, QetaIdEntity, UserResponse, Post, Collection, Answer, AnswerFilter, CollectionFilter, Comment, CommentFilter, PostFilter, TagResponse, TagFilter } from '@drodil/backstage-plugin-qeta-common';
|
|
5
5
|
import * as _backstage_plugin_permission_common from '@backstage/plugin-permission-common';
|
|
6
6
|
import { PolicyDecision } from '@backstage/plugin-permission-common';
|
|
7
7
|
import * as _backstage_plugin_permission_node from '@backstage/plugin-permission-node';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissionResources.cjs.js","sources":["../src/permissionResources.ts"],"sourcesContent":["import { createPermissionResourceRef } from '@backstage/plugin-permission-node';\nimport {\n Answer,\n ANSWER_RESOURCE_TYPE,\n AnswerFilter,\n Collection,\n COLLECTION_RESOUCE_TYPE,\n CollectionFilter,\n Comment,\n COMMENT_RESOURCE_TYPE,\n CommentFilter,\n Post,\n POST_RESOURCE_TYPE,\n PostFilter,\n TAG_RESOURCE_TYPE,\n TagFilter,\n TagResponse,\n} from '@drodil/backstage-plugin-qeta-common';\n\nexport const postPermissionResourceRef = createPermissionResourceRef<\n Post,\n PostFilter\n>().with({\n resourceType: POST_RESOURCE_TYPE,\n pluginId: 'qeta',\n});\n\nexport const answerPermissionResourceRef = createPermissionResourceRef<\n Answer,\n AnswerFilter\n>().with({\n resourceType: ANSWER_RESOURCE_TYPE,\n pluginId: 'qeta',\n});\n\nexport const commentPermissionResourceRef = createPermissionResourceRef<\n Comment,\n CommentFilter\n>().with({\n resourceType: COMMENT_RESOURCE_TYPE,\n pluginId: 'qeta',\n});\n\nexport const tagPermissionResourceRef = createPermissionResourceRef<\n TagResponse,\n TagFilter\n>().with({\n resourceType: TAG_RESOURCE_TYPE,\n pluginId: 'qeta',\n});\n\nexport const collectionPermissionResourceRef = createPermissionResourceRef<\n Collection,\n CollectionFilter\n>().with({\n resourceType: COLLECTION_RESOUCE_TYPE,\n pluginId: 'qeta',\n});\n"],"names":["createPermissionResourceRef","POST_RESOURCE_TYPE","ANSWER_RESOURCE_TYPE","COMMENT_RESOURCE_TYPE","TAG_RESOURCE_TYPE","COLLECTION_RESOUCE_TYPE"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"permissionResources.cjs.js","sources":["../src/permissionResources.ts"],"sourcesContent":["import { createPermissionResourceRef } from '@backstage/plugin-permission-node';\nimport {\n Answer,\n ANSWER_RESOURCE_TYPE,\n AnswerFilter,\n Collection,\n COLLECTION_RESOUCE_TYPE,\n CollectionFilter,\n Comment,\n COMMENT_RESOURCE_TYPE,\n CommentFilter,\n Post,\n POST_RESOURCE_TYPE,\n PostFilter,\n TAG_RESOURCE_TYPE,\n TagFilter,\n TagResponse,\n} from '@drodil/backstage-plugin-qeta-common';\n\nexport const postPermissionResourceRef = createPermissionResourceRef<\n Post,\n PostFilter\n>().with({\n resourceType: POST_RESOURCE_TYPE,\n pluginId: 'qeta',\n});\n\nexport const answerPermissionResourceRef = createPermissionResourceRef<\n Answer,\n AnswerFilter\n>().with({\n resourceType: ANSWER_RESOURCE_TYPE,\n pluginId: 'qeta',\n});\n\nexport const commentPermissionResourceRef = createPermissionResourceRef<\n Comment,\n CommentFilter\n>().with({\n resourceType: COMMENT_RESOURCE_TYPE,\n pluginId: 'qeta',\n});\n\nexport const tagPermissionResourceRef = createPermissionResourceRef<\n TagResponse,\n TagFilter\n>().with({\n resourceType: TAG_RESOURCE_TYPE,\n pluginId: 'qeta',\n});\n\nexport const collectionPermissionResourceRef = createPermissionResourceRef<\n Collection,\n CollectionFilter\n>().with({\n resourceType: COLLECTION_RESOUCE_TYPE,\n pluginId: 'qeta',\n});\n"],"names":["createPermissionResourceRef","POST_RESOURCE_TYPE","ANSWER_RESOURCE_TYPE","COMMENT_RESOURCE_TYPE","TAG_RESOURCE_TYPE","COLLECTION_RESOUCE_TYPE"],"mappings":";;;;;AAmBO,MAAM,yBAAA,GAA4BA,gDAAA,EAGvC,CAAE,IAAA,CAAK;AAAA,EACP,YAAA,EAAcC,4CAAA;AAAA,EACd,QAAA,EAAU;AACZ,CAAC;AAEM,MAAM,2BAAA,GAA8BD,gDAAA,EAGzC,CAAE,IAAA,CAAK;AAAA,EACP,YAAA,EAAcE,8CAAA;AAAA,EACd,QAAA,EAAU;AACZ,CAAC;AAEM,MAAM,4BAAA,GAA+BF,gDAAA,EAG1C,CAAE,IAAA,CAAK;AAAA,EACP,YAAA,EAAcG,+CAAA;AAAA,EACd,QAAA,EAAU;AACZ,CAAC;AAEM,MAAM,wBAAA,GAA2BH,gDAAA,EAGtC,CAAE,IAAA,CAAK;AAAA,EACP,YAAA,EAAcI,2CAAA;AAAA,EACd,QAAA,EAAU;AACZ,CAAC;AAEM,MAAM,+BAAA,GAAkCJ,gDAAA,EAG7C,CAAE,IAAA,CAAK;AAAA,EACP,YAAA,EAAcK,iDAAA;AAAA,EACd,QAAA,EAAU;AACZ,CAAC;;;;;;;;"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var pluginPermissionNode = require('@backstage/plugin-permission-node');
|
|
4
|
-
var
|
|
4
|
+
var v3 = require('zod/v3');
|
|
5
5
|
var permissionResources = require('./permissionResources.cjs.js');
|
|
6
6
|
|
|
7
7
|
const isPostAuthor = pluginPermissionNode.createPermissionRule({
|
|
8
8
|
name: "IS_AUTHOR",
|
|
9
9
|
description: "Should allow only if the post is created by the user",
|
|
10
10
|
resourceRef: permissionResources.postPermissionResourceRef,
|
|
11
|
-
paramsSchema:
|
|
12
|
-
userRef:
|
|
13
|
-
claims:
|
|
11
|
+
paramsSchema: v3.z.object({
|
|
12
|
+
userRef: v3.z.string().describe("User ID to match on the author").optional(),
|
|
13
|
+
claims: v3.z.array(v3.z.string()).optional().describe("List of claims to match at least one on within author")
|
|
14
14
|
}),
|
|
15
15
|
apply: (resource, { userRef, claims = [] }) => {
|
|
16
16
|
return resource?.author === userRef || claims.includes(resource?.author);
|
|
@@ -27,8 +27,8 @@ const postHasTags = pluginPermissionNode.createPermissionRule({
|
|
|
27
27
|
name: "HAS_TAGS",
|
|
28
28
|
description: "Should allow only if the post has all the specific tags",
|
|
29
29
|
resourceRef: permissionResources.postPermissionResourceRef,
|
|
30
|
-
paramsSchema:
|
|
31
|
-
tags:
|
|
30
|
+
paramsSchema: v3.z.object({
|
|
31
|
+
tags: v3.z.array(v3.z.string()).describe("Tag to match the post")
|
|
32
32
|
}),
|
|
33
33
|
apply: (resource, { tags }) => {
|
|
34
34
|
return tags.every((t) => resource?.tags?.includes(t));
|
|
@@ -48,8 +48,8 @@ const postHasAnyTag = pluginPermissionNode.createPermissionRule({
|
|
|
48
48
|
name: "HAS_ANY_TAG",
|
|
49
49
|
description: "Should allow only if the post has any of the specific tags",
|
|
50
50
|
resourceRef: permissionResources.postPermissionResourceRef,
|
|
51
|
-
paramsSchema:
|
|
52
|
-
tags:
|
|
51
|
+
paramsSchema: v3.z.object({
|
|
52
|
+
tags: v3.z.array(v3.z.string()).describe("Tag to match the post")
|
|
53
53
|
}),
|
|
54
54
|
apply: (resource, { tags }) => {
|
|
55
55
|
return tags.some((t) => resource?.tags?.includes(t));
|
|
@@ -66,8 +66,8 @@ const postHasEntities = pluginPermissionNode.createPermissionRule({
|
|
|
66
66
|
name: "HAS_ENTITIES",
|
|
67
67
|
description: "Should allow only if the post has all the specific entities",
|
|
68
68
|
resourceRef: permissionResources.postPermissionResourceRef,
|
|
69
|
-
paramsSchema:
|
|
70
|
-
entityRefs:
|
|
69
|
+
paramsSchema: v3.z.object({
|
|
70
|
+
entityRefs: v3.z.array(v3.z.string()).describe("Entity refs to match the post")
|
|
71
71
|
}),
|
|
72
72
|
apply: (resource, { entityRefs }) => {
|
|
73
73
|
return entityRefs.every((t) => resource?.entities?.includes(t));
|
|
@@ -87,8 +87,8 @@ const postHasAnyEntity = pluginPermissionNode.createPermissionRule({
|
|
|
87
87
|
name: "HAS_ANY_ENTITY",
|
|
88
88
|
description: "Should allow only if the post has any of the specific entities",
|
|
89
89
|
resourceRef: permissionResources.postPermissionResourceRef,
|
|
90
|
-
paramsSchema:
|
|
91
|
-
entityRefs:
|
|
90
|
+
paramsSchema: v3.z.object({
|
|
91
|
+
entityRefs: v3.z.array(v3.z.string()).describe("Entity refs to match the post")
|
|
92
92
|
}),
|
|
93
93
|
apply: (resource, { entityRefs }) => {
|
|
94
94
|
return entityRefs.some((t) => resource?.entities?.includes(t));
|
|
@@ -105,8 +105,8 @@ const postHasType = pluginPermissionNode.createPermissionRule({
|
|
|
105
105
|
name: "HAS_TYPE",
|
|
106
106
|
description: "Should allow only if the post has the specific type",
|
|
107
107
|
resourceRef: permissionResources.postPermissionResourceRef,
|
|
108
|
-
paramsSchema:
|
|
109
|
-
type:
|
|
108
|
+
paramsSchema: v3.z.object({
|
|
109
|
+
type: v3.z.string().describe("Type to match the post")
|
|
110
110
|
}),
|
|
111
111
|
apply: (resource, { type }) => {
|
|
112
112
|
return resource?.type === type;
|
|
@@ -123,9 +123,9 @@ const isPostTagExpert = pluginPermissionNode.createPermissionRule({
|
|
|
123
123
|
name: "IS_POST_TAG_EXPERT",
|
|
124
124
|
description: "Allows if post has tags the user is expert of",
|
|
125
125
|
resourceRef: permissionResources.postPermissionResourceRef,
|
|
126
|
-
paramsSchema:
|
|
127
|
-
userRef:
|
|
128
|
-
claims:
|
|
126
|
+
paramsSchema: v3.z.object({
|
|
127
|
+
userRef: v3.z.string().describe("User ID to match on the tag expert").optional(),
|
|
128
|
+
claims: v3.z.array(v3.z.string()).optional().describe("List of claims to match at least one on within tag expert")
|
|
129
129
|
}),
|
|
130
130
|
apply: (resource, { userRef, claims }) => {
|
|
131
131
|
return Boolean(
|
|
@@ -144,8 +144,8 @@ const postDoesNotHaveTags = pluginPermissionNode.createPermissionRule({
|
|
|
144
144
|
name: "DOES_NOT_HAVE_TAGS",
|
|
145
145
|
description: "Should allow only if the post does not have any of the specific tags",
|
|
146
146
|
resourceRef: permissionResources.postPermissionResourceRef,
|
|
147
|
-
paramsSchema:
|
|
148
|
-
tags:
|
|
147
|
+
paramsSchema: v3.z.object({
|
|
148
|
+
tags: v3.z.array(v3.z.string()).describe("Tags that should not be on the post")
|
|
149
149
|
}),
|
|
150
150
|
apply: (resource, { tags }) => {
|
|
151
151
|
return !tags.some((t) => resource?.tags?.includes(t));
|
|
@@ -164,8 +164,8 @@ const postDoesNotHaveEntities = pluginPermissionNode.createPermissionRule({
|
|
|
164
164
|
name: "DOES_NOT_HAVE_ENTITIES",
|
|
165
165
|
description: "Should allow only if the post does not have any of the specific entities",
|
|
166
166
|
resourceRef: permissionResources.postPermissionResourceRef,
|
|
167
|
-
paramsSchema:
|
|
168
|
-
entityRefs:
|
|
167
|
+
paramsSchema: v3.z.object({
|
|
168
|
+
entityRefs: v3.z.array(v3.z.string()).describe("Entity refs that should not be on the post")
|
|
169
169
|
}),
|
|
170
170
|
apply: (resource, { entityRefs }) => {
|
|
171
171
|
return !entityRefs.some((t) => resource?.entities?.includes(t));
|
|
@@ -197,9 +197,9 @@ const isAnswerAuthor = pluginPermissionNode.createPermissionRule({
|
|
|
197
197
|
name: "IS_AUTHOR",
|
|
198
198
|
description: "Should allow only if the answer is created by the user",
|
|
199
199
|
resourceRef: permissionResources.answerPermissionResourceRef,
|
|
200
|
-
paramsSchema:
|
|
201
|
-
userRef:
|
|
202
|
-
claims:
|
|
200
|
+
paramsSchema: v3.z.object({
|
|
201
|
+
userRef: v3.z.string().describe("User ID to match on the author").optional(),
|
|
202
|
+
claims: v3.z.array(v3.z.string()).optional().describe("List of claims to match at least one on within author")
|
|
203
203
|
}),
|
|
204
204
|
apply: (resource, { userRef, claims = [] }) => {
|
|
205
205
|
return resource?.author === userRef || claims.includes(resource?.author);
|
|
@@ -216,8 +216,8 @@ const answerQuestionHasTags = pluginPermissionNode.createPermissionRule({
|
|
|
216
216
|
name: "HAS_TAGS",
|
|
217
217
|
description: "Should allow only if the answers question has all the specific tags",
|
|
218
218
|
resourceRef: permissionResources.answerPermissionResourceRef,
|
|
219
|
-
paramsSchema:
|
|
220
|
-
tags:
|
|
219
|
+
paramsSchema: v3.z.object({
|
|
220
|
+
tags: v3.z.array(v3.z.string()).describe("Tag to match the question")
|
|
221
221
|
}),
|
|
222
222
|
apply: (resource, { tags }) => {
|
|
223
223
|
return tags.every((t) => resource?.post?.tags?.includes(t));
|
|
@@ -239,8 +239,8 @@ const answerQuestionHasAnyTag = pluginPermissionNode.createPermissionRule({
|
|
|
239
239
|
name: "HAS_ANY_TAG",
|
|
240
240
|
description: "Should allow only if the answers question has any of the specific tags",
|
|
241
241
|
resourceRef: permissionResources.answerPermissionResourceRef,
|
|
242
|
-
paramsSchema:
|
|
243
|
-
tags:
|
|
242
|
+
paramsSchema: v3.z.object({
|
|
243
|
+
tags: v3.z.array(v3.z.string()).describe("Tag to match the question")
|
|
244
244
|
}),
|
|
245
245
|
apply: (resource, { tags }) => {
|
|
246
246
|
return tags.some((t) => resource?.post?.tags?.includes(t));
|
|
@@ -259,8 +259,8 @@ const answerQuestionHasEntityRefs = pluginPermissionNode.createPermissionRule({
|
|
|
259
259
|
name: "HAS_ENTITIES",
|
|
260
260
|
description: "Should allow only if the answers question has all the specific entities",
|
|
261
261
|
resourceRef: permissionResources.answerPermissionResourceRef,
|
|
262
|
-
paramsSchema:
|
|
263
|
-
entityRefs:
|
|
262
|
+
paramsSchema: v3.z.object({
|
|
263
|
+
entityRefs: v3.z.array(v3.z.string()).describe("Tag to match the question")
|
|
264
264
|
}),
|
|
265
265
|
apply: (resource, { entityRefs }) => {
|
|
266
266
|
return entityRefs.every((t) => resource?.post?.entities?.includes(t));
|
|
@@ -282,8 +282,8 @@ const answerQuestionHasAnyEntityRefs = pluginPermissionNode.createPermissionRule
|
|
|
282
282
|
name: "HAS_ANY_ENTITIES",
|
|
283
283
|
description: "Should allow only if the answers question has any of the specific entities",
|
|
284
284
|
resourceRef: permissionResources.answerPermissionResourceRef,
|
|
285
|
-
paramsSchema:
|
|
286
|
-
entityRefs:
|
|
285
|
+
paramsSchema: v3.z.object({
|
|
286
|
+
entityRefs: v3.z.array(v3.z.string()).describe("Tag to match the question")
|
|
287
287
|
}),
|
|
288
288
|
apply: (resource, { entityRefs }) => {
|
|
289
289
|
return entityRefs.some((t) => resource?.post?.entities?.includes(t));
|
|
@@ -300,9 +300,9 @@ const isAnswerTagExpert = pluginPermissionNode.createPermissionRule({
|
|
|
300
300
|
name: "IS_ANSWER_TAG_EXPERT",
|
|
301
301
|
description: "Allows if answers post has tags the user is expert of",
|
|
302
302
|
resourceRef: permissionResources.answerPermissionResourceRef,
|
|
303
|
-
paramsSchema:
|
|
304
|
-
userRef:
|
|
305
|
-
claims:
|
|
303
|
+
paramsSchema: v3.z.object({
|
|
304
|
+
userRef: v3.z.string().describe("User ID to match on the tag expert").optional(),
|
|
305
|
+
claims: v3.z.array(v3.z.string()).optional().describe("List of claims to match at least one on within tag expert")
|
|
306
306
|
}),
|
|
307
307
|
apply: (resource, { userRef, claims }) => {
|
|
308
308
|
return Boolean(
|
|
@@ -321,8 +321,8 @@ const answerQuestionDoesNotHaveTags = pluginPermissionNode.createPermissionRule(
|
|
|
321
321
|
name: "DOES_NOT_HAVE_TAGS",
|
|
322
322
|
description: "Should allow only if the answers question does not have any of the specific tags",
|
|
323
323
|
resourceRef: permissionResources.answerPermissionResourceRef,
|
|
324
|
-
paramsSchema:
|
|
325
|
-
tags:
|
|
324
|
+
paramsSchema: v3.z.object({
|
|
325
|
+
tags: v3.z.array(v3.z.string()).describe("Tags that should not be on the question")
|
|
326
326
|
}),
|
|
327
327
|
apply: (resource, { tags }) => {
|
|
328
328
|
return !tags.some((t) => resource?.post?.tags?.includes(t));
|
|
@@ -341,8 +341,8 @@ const answerQuestionDoesNotHaveEntityRefs = pluginPermissionNode.createPermissio
|
|
|
341
341
|
name: "DOES_NOT_HAVE_ENTITIES",
|
|
342
342
|
description: "Should allow only if the answers question does not have any of the specific entities",
|
|
343
343
|
resourceRef: permissionResources.answerPermissionResourceRef,
|
|
344
|
-
paramsSchema:
|
|
345
|
-
entityRefs:
|
|
344
|
+
paramsSchema: v3.z.object({
|
|
345
|
+
entityRefs: v3.z.array(v3.z.string()).describe("Entity refs that should not be on the question")
|
|
346
346
|
}),
|
|
347
347
|
apply: (resource, { entityRefs }) => {
|
|
348
348
|
return !entityRefs.some((t) => resource?.post?.entities?.includes(t));
|
|
@@ -371,9 +371,9 @@ const isCommentAuthor = pluginPermissionNode.createPermissionRule({
|
|
|
371
371
|
name: "IS_AUTHOR",
|
|
372
372
|
description: "Should allow only if the comment is created by the user",
|
|
373
373
|
resourceRef: permissionResources.commentPermissionResourceRef,
|
|
374
|
-
paramsSchema:
|
|
375
|
-
userRef:
|
|
376
|
-
claims:
|
|
374
|
+
paramsSchema: v3.z.object({
|
|
375
|
+
userRef: v3.z.string().describe("User ID to match on the author").optional(),
|
|
376
|
+
claims: v3.z.array(v3.z.string()).optional().describe("List of claims to match at least one on within author")
|
|
377
377
|
}),
|
|
378
378
|
apply: (resource, { userRef, claims = [] }) => {
|
|
379
379
|
return resource?.author === userRef || claims.includes(resource?.author);
|
|
@@ -391,8 +391,8 @@ const isTag = pluginPermissionNode.createPermissionRule({
|
|
|
391
391
|
name: "IS_TAG",
|
|
392
392
|
description: "Should allow only if the tag exists",
|
|
393
393
|
resourceRef: permissionResources.tagPermissionResourceRef,
|
|
394
|
-
paramsSchema:
|
|
395
|
-
tag:
|
|
394
|
+
paramsSchema: v3.z.object({
|
|
395
|
+
tag: v3.z.string().describe("Tag to match the post")
|
|
396
396
|
}),
|
|
397
397
|
apply: (resource, { tag }) => {
|
|
398
398
|
return resource?.tag === tag;
|
|
@@ -409,9 +409,9 @@ const isTagExpert = pluginPermissionNode.createPermissionRule({
|
|
|
409
409
|
name: "IS_TAG_EXPERT",
|
|
410
410
|
description: "Allows only if user is tag expert",
|
|
411
411
|
resourceRef: permissionResources.tagPermissionResourceRef,
|
|
412
|
-
paramsSchema:
|
|
413
|
-
userRef:
|
|
414
|
-
claims:
|
|
412
|
+
paramsSchema: v3.z.object({
|
|
413
|
+
userRef: v3.z.string().describe("User ID to match on the tag expert").optional(),
|
|
414
|
+
claims: v3.z.array(v3.z.string()).optional().describe("List of claims to match at least one on within tag expert")
|
|
415
415
|
}),
|
|
416
416
|
apply: (resource, { userRef, claims }) => {
|
|
417
417
|
return Boolean(
|
|
@@ -431,9 +431,9 @@ const isCollectionOwner = pluginPermissionNode.createPermissionRule({
|
|
|
431
431
|
name: "IS_OWNER",
|
|
432
432
|
description: "Should allow only if the collection is owned by the user",
|
|
433
433
|
resourceRef: permissionResources.collectionPermissionResourceRef,
|
|
434
|
-
paramsSchema:
|
|
435
|
-
userRef:
|
|
436
|
-
claims:
|
|
434
|
+
paramsSchema: v3.z.object({
|
|
435
|
+
userRef: v3.z.string().describe("User reference to match on the owner").optional(),
|
|
436
|
+
claims: v3.z.array(v3.z.string()).optional().describe("List of claims to match at least one on within owner")
|
|
437
437
|
}),
|
|
438
438
|
apply: (resource, { userRef, claims = [] }) => {
|
|
439
439
|
return resource?.owner === userRef || claims.includes(resource?.owner);
|
|
@@ -450,8 +450,8 @@ const collectionHasTags = pluginPermissionNode.createPermissionRule({
|
|
|
450
450
|
name: "HAS_TAGS",
|
|
451
451
|
description: "Should allow only if the posts in the collection have the specific tags",
|
|
452
452
|
resourceRef: permissionResources.collectionPermissionResourceRef,
|
|
453
|
-
paramsSchema:
|
|
454
|
-
tags:
|
|
453
|
+
paramsSchema: v3.z.object({
|
|
454
|
+
tags: v3.z.array(v3.z.string()).describe("Tag to match the collection")
|
|
455
455
|
}),
|
|
456
456
|
apply: (resource, { tags }) => {
|
|
457
457
|
return tags.every((t) => resource?.tags?.includes(t));
|
|
@@ -471,8 +471,8 @@ const collectionHasAnyTag = pluginPermissionNode.createPermissionRule({
|
|
|
471
471
|
name: "HAS_ANY_TAG",
|
|
472
472
|
description: "Should allow only if the posts in the collection have some of the specific tags",
|
|
473
473
|
resourceRef: permissionResources.collectionPermissionResourceRef,
|
|
474
|
-
paramsSchema:
|
|
475
|
-
tags:
|
|
474
|
+
paramsSchema: v3.z.object({
|
|
475
|
+
tags: v3.z.array(v3.z.string()).describe("Tag to match the collection")
|
|
476
476
|
}),
|
|
477
477
|
apply: (resource, { tags }) => {
|
|
478
478
|
return tags.some((t) => resource?.tags?.includes(t));
|
|
@@ -489,8 +489,8 @@ const collectionHasEntities = pluginPermissionNode.createPermissionRule({
|
|
|
489
489
|
name: "HAS_ENTITIES",
|
|
490
490
|
description: "Should allow only if the posts in the collection have all the specific entities",
|
|
491
491
|
resourceRef: permissionResources.collectionPermissionResourceRef,
|
|
492
|
-
paramsSchema:
|
|
493
|
-
entityRefs:
|
|
492
|
+
paramsSchema: v3.z.object({
|
|
493
|
+
entityRefs: v3.z.array(v3.z.string()).describe("Entity refs to match the collection")
|
|
494
494
|
}),
|
|
495
495
|
apply: (resource, { entityRefs }) => {
|
|
496
496
|
return entityRefs.every((t) => resource?.entities?.includes(t));
|
|
@@ -514,8 +514,8 @@ const collectionHasAnyEntity = pluginPermissionNode.createPermissionRule({
|
|
|
514
514
|
name: "HAS_ANY_ENTITY",
|
|
515
515
|
description: "Should allow only if the posts in the collection have some of the specific entities",
|
|
516
516
|
resourceRef: permissionResources.collectionPermissionResourceRef,
|
|
517
|
-
paramsSchema:
|
|
518
|
-
entityRefs:
|
|
517
|
+
paramsSchema: v3.z.object({
|
|
518
|
+
entityRefs: v3.z.array(v3.z.string()).describe("Entity refs to match the collection")
|
|
519
519
|
}),
|
|
520
520
|
apply: (resource, { entityRefs }) => {
|
|
521
521
|
return entityRefs.some((t) => resource?.entities?.includes(t));
|
|
@@ -534,9 +534,9 @@ const isCollectionTagExpert = pluginPermissionNode.createPermissionRule({
|
|
|
534
534
|
name: "IS_COLLECTION_TAG_EXPERT",
|
|
535
535
|
description: "Allows if collection has tags the user is expert of",
|
|
536
536
|
resourceRef: permissionResources.collectionPermissionResourceRef,
|
|
537
|
-
paramsSchema:
|
|
538
|
-
userRef:
|
|
539
|
-
claims:
|
|
537
|
+
paramsSchema: v3.z.object({
|
|
538
|
+
userRef: v3.z.string().describe("User ID to match on the tag expert").optional(),
|
|
539
|
+
claims: v3.z.array(v3.z.string()).optional().describe("List of claims to match at least one on within tag expert")
|
|
540
540
|
}),
|
|
541
541
|
apply: (resource, { userRef, claims }) => {
|
|
542
542
|
return Boolean(
|
|
@@ -557,8 +557,8 @@ const collectionDoesNotHaveTags = pluginPermissionNode.createPermissionRule({
|
|
|
557
557
|
name: "DOES_NOT_HAVE_TAGS",
|
|
558
558
|
description: "Should allow only if the posts in the collection do not have any of the specific tags",
|
|
559
559
|
resourceRef: permissionResources.collectionPermissionResourceRef,
|
|
560
|
-
paramsSchema:
|
|
561
|
-
tags:
|
|
560
|
+
paramsSchema: v3.z.object({
|
|
561
|
+
tags: v3.z.array(v3.z.string()).describe("Tags that should not be in the collection")
|
|
562
562
|
}),
|
|
563
563
|
apply: (resource, { tags }) => {
|
|
564
564
|
return !tags.some((t) => resource?.tags?.includes(t));
|
|
@@ -579,8 +579,8 @@ const collectionDoesNotHaveEntities = pluginPermissionNode.createPermissionRule(
|
|
|
579
579
|
name: "DOES_NOT_HAVE_ENTITIES",
|
|
580
580
|
description: "Should allow only if the posts in the collection do not have any of the specific entities",
|
|
581
581
|
resourceRef: permissionResources.collectionPermissionResourceRef,
|
|
582
|
-
paramsSchema:
|
|
583
|
-
entityRefs:
|
|
582
|
+
paramsSchema: v3.z.object({
|
|
583
|
+
entityRefs: v3.z.array(v3.z.string()).describe("Entity refs that should not be in the collection")
|
|
584
584
|
}),
|
|
585
585
|
apply: (resource, { entityRefs }) => {
|
|
586
586
|
return !entityRefs.some((t) => resource?.entities?.includes(t));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissionRules.cjs.js","sources":["../src/permissionRules.ts"],"sourcesContent":["import {\n createConditionFactory,\n createPermissionRule,\n} from '@backstage/plugin-permission-node';\nimport { z } from 'zod';\nimport {\n Answer,\n AnswerFilter,\n Collection,\n CollectionFilter,\n Comment,\n CommentFilter,\n Post,\n PostFilter,\n TagFilter,\n TagResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport {\n answerPermissionResourceRef,\n collectionPermissionResourceRef,\n commentPermissionResourceRef,\n postPermissionResourceRef,\n tagPermissionResourceRef,\n} from './permissionResources';\nimport { PermissionCriteria } from '@backstage/plugin-permission-common';\n\nexport const isPostAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the post is created by the user',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Post, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'posts.author' as PostFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const postAuthorConditionFactory = createConditionFactory(isPostAuthor);\n\nexport const postHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description: 'Should allow only if the post has all the specific tags',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the post'),\n }),\n apply: (resource: Post, { tags }) => {\n return tags.every(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n const filters: PermissionCriteria<PostFilter>[] = tags.map(e => ({\n property: 'tags' as PostFilter['property'],\n values: [e],\n }));\n\n return {\n allOf: filters,\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postHasTagsConditionFactory = createConditionFactory(postHasTags);\n\nexport const postHasAnyTag = createPermissionRule({\n name: 'HAS_ANY_TAG',\n description: 'Should allow only if the post has any of the specific tags',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the post'),\n }),\n apply: (resource: Post, { tags }) => {\n return tags.some(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as PostFilter['property'],\n values: tags,\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postHasAnyTagConditionFactory =\n createConditionFactory(postHasAnyTag);\n\nexport const postHasEntities = createPermissionRule({\n name: 'HAS_ENTITIES',\n description: 'Should allow only if the post has all the specific entities',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Entity refs to match the post'),\n }),\n apply: (resource: Post, { entityRefs }) => {\n return entityRefs.every(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }): PermissionCriteria<PostFilter> => {\n const filters: PermissionCriteria<PostFilter>[] = entityRefs.map(e => ({\n property: 'entityRefs' as PostFilter['property'],\n values: [e],\n }));\n\n return {\n allOf: filters,\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postHasEntitiesConditionFactory =\n createConditionFactory(postHasEntities);\n\nexport const postHasAnyEntity = createPermissionRule({\n name: 'HAS_ANY_ENTITY',\n description: 'Should allow only if the post has any of the specific entities',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Entity refs to match the post'),\n }),\n apply: (resource: Post, { entityRefs }) => {\n return entityRefs.some(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }): PermissionCriteria<PostFilter> => {\n return {\n property: 'entityRefs' as PostFilter['property'],\n values: entityRefs,\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postHasAnyEntityConditionFactory =\n createConditionFactory(postHasAnyEntity);\n\nexport const postHasType = createPermissionRule({\n name: 'HAS_TYPE',\n description: 'Should allow only if the post has the specific type',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n type: z.string().describe('Type to match the post'),\n }),\n apply: (resource: Post, { type }) => {\n return resource?.type === type;\n },\n toQuery: ({ type }) => {\n return {\n property: 'posts.type' as PostFilter['property'],\n values: [type],\n };\n },\n});\n\nexport const postHasTypeConditionFactory = createConditionFactory(postHasType);\n\nexport const isPostTagExpert = createPermissionRule({\n name: 'IS_POST_TAG_EXPERT',\n description: 'Allows if post has tags the user is expert of',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User ID to match on the tag expert')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within tag expert'),\n }),\n apply: (resource: Post, { userRef, claims }) => {\n return Boolean(\n resource?.experts?.some(e => e === userRef || claims?.includes(e)),\n );\n },\n toQuery: ({ claims = [], userRef }) => {\n return {\n property: 'tag.experts' as PostFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const postTagExpertConditionFactory =\n createConditionFactory(isPostTagExpert);\n\nexport const postDoesNotHaveTags = createPermissionRule({\n name: 'DOES_NOT_HAVE_TAGS',\n description:\n 'Should allow only if the post does not have any of the specific tags',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tags that should not be on the post'),\n }),\n apply: (resource: Post, { tags }) => {\n return !tags.some(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n not: {\n property: 'tags' as PostFilter['property'],\n values: tags,\n },\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postDoesNotHaveTagsConditionFactory =\n createConditionFactory(postDoesNotHaveTags);\n\nexport const postDoesNotHaveEntities = createPermissionRule({\n name: 'DOES_NOT_HAVE_ENTITIES',\n description:\n 'Should allow only if the post does not have any of the specific entities',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs that should not be on the post'),\n }),\n apply: (resource: Post, { entityRefs }) => {\n return !entityRefs.some(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }): PermissionCriteria<PostFilter> => {\n return {\n not: {\n property: 'entityRefs' as PostFilter['property'],\n values: entityRefs,\n },\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postDoesNotHaveEntitiesConditionFactory = createConditionFactory(\n postDoesNotHaveEntities,\n);\n\nexport const postRules = {\n isPostAuthor,\n postHasTags,\n postHasAnyTag,\n postHasEntities,\n postHasAnyEntity,\n postHasType,\n isPostTagExpert,\n postDoesNotHaveTags,\n postDoesNotHaveEntities,\n};\n\nexport const isAnswerAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the answer is created by the user',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Answer, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'answers.author' as AnswerFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const answerAuthorConditionFactory =\n createConditionFactory(isAnswerAuthor);\n\nexport const answerQuestionHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description:\n 'Should allow only if the answers question has all the specific tags',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { tags }) => {\n return tags.every(t => resource?.post?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n const filters: PermissionCriteria<AnswerFilter>[] = tags.map(e => ({\n property: 'tags' as AnswerFilter['property'],\n values: [e],\n }));\n\n return {\n allOf: filters,\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionTagsConditionFactory = createConditionFactory(\n answerQuestionHasTags,\n);\n\nexport const answerQuestionHasAnyTag = createPermissionRule({\n name: 'HAS_ANY_TAG',\n description:\n 'Should allow only if the answers question has any of the specific tags',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { tags }) => {\n return tags.some(t => resource?.post?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as AnswerFilter['property'],\n values: tags,\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionAnyTagConditionFactory = createConditionFactory(\n answerQuestionHasAnyTag,\n);\n\nexport const answerQuestionHasEntityRefs = createPermissionRule({\n name: 'HAS_ENTITIES',\n description:\n 'Should allow only if the answers question has all the specific entities',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { entityRefs }) => {\n return entityRefs.every(t => resource?.post?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n const filters: PermissionCriteria<AnswerFilter>[] = entityRefs.map(e => ({\n property: 'entityRefs' as AnswerFilter['property'],\n values: [e],\n }));\n\n return {\n allOf: filters,\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionEntitiesConditionFactory = createConditionFactory(\n answerQuestionHasEntityRefs,\n);\n\nexport const answerQuestionHasAnyEntityRefs = createPermissionRule({\n name: 'HAS_ANY_ENTITIES',\n description:\n 'Should allow only if the answers question has any of the specific entities',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { entityRefs }) => {\n return entityRefs.some(t => resource?.post?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n property: 'entityRefs' as AnswerFilter['property'],\n values: entityRefs,\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionHasAnyEntitiesConditionFactory =\n createConditionFactory(answerQuestionHasEntityRefs);\n\nexport const isAnswerTagExpert = createPermissionRule({\n name: 'IS_ANSWER_TAG_EXPERT',\n description: 'Allows if answers post has tags the user is expert of',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User ID to match on the tag expert')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within tag expert'),\n }),\n apply: (resource: Answer, { userRef, claims }) => {\n return Boolean(\n resource?.experts?.some(e => e === userRef || claims?.includes(e)),\n );\n },\n toQuery: ({ claims = [], userRef }) => {\n return {\n property: 'tag.experts' as AnswerFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const answerTagExpertConditionFactory =\n createConditionFactory(isAnswerTagExpert);\n\nexport const answerQuestionDoesNotHaveTags = createPermissionRule({\n name: 'DOES_NOT_HAVE_TAGS',\n description:\n 'Should allow only if the answers question does not have any of the specific tags',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n tags: z\n .array(z.string())\n .describe('Tags that should not be on the question'),\n }),\n apply: (resource: Answer, { tags }) => {\n return !tags.some(t => resource?.post?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n not: {\n property: 'tags' as AnswerFilter['property'],\n values: tags,\n },\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionDoesNotHaveTagsConditionFactory =\n createConditionFactory(answerQuestionDoesNotHaveTags);\n\nexport const answerQuestionDoesNotHaveEntityRefs = createPermissionRule({\n name: 'DOES_NOT_HAVE_ENTITIES',\n description:\n 'Should allow only if the answers question does not have any of the specific entities',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs that should not be on the question'),\n }),\n apply: (resource: Answer, { entityRefs }) => {\n return !entityRefs.some(t => resource?.post?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n not: {\n property: 'entityRefs' as AnswerFilter['property'],\n values: entityRefs,\n },\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionDoesNotHaveEntitiesConditionFactory =\n createConditionFactory(answerQuestionDoesNotHaveEntityRefs);\n\nexport const answerRules = {\n isAnswerAuthor,\n answerQuestionHasTags,\n answerQuestionHasAnyTag,\n answerQuestionHasEntityRefs,\n answerQuestionHasAnyEntityRefs,\n isAnswerTagExpert,\n answerQuestionDoesNotHaveTags,\n answerQuestionDoesNotHaveEntityRefs,\n};\n\nexport const isCommentAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the comment is created by the user',\n resourceRef: commentPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Comment, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'comments.author' as CommentFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const commentAuthorConditionFactory =\n createConditionFactory(isCommentAuthor);\n\nexport const commentRules = { isCommentAuthor };\n\nexport const isTag = createPermissionRule({\n name: 'IS_TAG',\n description: 'Should allow only if the tag exists',\n resourceRef: tagPermissionResourceRef,\n paramsSchema: z.object({\n tag: z.string().describe('Tag to match the post'),\n }),\n apply: (resource: TagResponse, { tag }) => {\n return resource?.tag === tag;\n },\n toQuery: ({ tag }) => {\n return {\n property: 'tags.tag' as TagFilter['property'],\n values: [tag],\n };\n },\n});\n\nexport const tagConditionFactory = createConditionFactory(isTag);\n\nexport const isTagExpert = createPermissionRule({\n name: 'IS_TAG_EXPERT',\n description: 'Allows only if user is tag expert',\n resourceRef: tagPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User ID to match on the tag expert')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within tag expert'),\n }),\n apply: (resource: TagResponse, { userRef, claims }) => {\n return Boolean(\n resource?.experts?.some(e => e === userRef || claims?.includes(e)),\n );\n },\n toQuery: ({ claims = [], userRef }) => {\n return {\n property: 'tag.experts' as TagFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const tagExpertConditionFactory = createConditionFactory(isTagExpert);\n\nexport const tagRules = { isTag, isTagExpert };\n\nexport const isCollectionOwner = createPermissionRule({\n name: 'IS_OWNER',\n description: 'Should allow only if the collection is owned by the user',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User reference to match on the owner')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within owner'),\n }),\n apply: (resource: Collection, { userRef, claims = [] }) => {\n return resource?.owner === userRef || claims.includes(resource?.owner);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'collections.owner' as CollectionFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const collectionOwnerConditionFactory =\n createConditionFactory(isCollectionOwner);\n\nexport const collectionHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description:\n 'Should allow only if the posts in the collection have the specific tags',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the collection'),\n }),\n apply: (resource: Collection, { tags }) => {\n return tags.every(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n const filters: PermissionCriteria<CollectionFilter>[] = tags.map(e => ({\n property: 'tags' as CollectionFilter['property'],\n values: [e],\n }));\n\n return {\n allOf: filters,\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionHasTagsConditionFactory =\n createConditionFactory(collectionHasTags);\n\nexport const collectionHasAnyTag = createPermissionRule({\n name: 'HAS_ANY_TAG',\n description:\n 'Should allow only if the posts in the collection have some of the specific tags',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the collection'),\n }),\n apply: (resource: Collection, { tags }) => {\n return tags.some(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as CollectionFilter['property'],\n values: tags,\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionHasAnyTagConditionFactory =\n createConditionFactory(collectionHasAnyTag);\n\nexport const collectionHasEntities = createPermissionRule({\n name: 'HAS_ENTITIES',\n description:\n 'Should allow only if the posts in the collection have all the specific entities',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs to match the collection'),\n }),\n apply: (resource: Collection, { entityRefs }) => {\n return entityRefs.every(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n const filters: PermissionCriteria<CollectionFilter>[] = entityRefs.map(\n e => ({\n property: 'entityRefs' as CollectionFilter['property'],\n values: [e],\n }),\n );\n\n return {\n allOf: filters,\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionHasEntitiesConditionFactory = createConditionFactory(\n collectionHasEntities,\n);\n\nexport const collectionHasAnyEntity = createPermissionRule({\n name: 'HAS_ANY_ENTITY',\n description:\n 'Should allow only if the posts in the collection have some of the specific entities',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs to match the collection'),\n }),\n apply: (resource: Collection, { entityRefs }) => {\n return entityRefs.some(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n property: 'entityRefs' as CollectionFilter['property'],\n values: entityRefs,\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionHasAnyEntityConditionFactory = createConditionFactory(\n collectionHasAnyEntity,\n);\n\nexport const isCollectionTagExpert = createPermissionRule({\n name: 'IS_COLLECTION_TAG_EXPERT',\n description: 'Allows if collection has tags the user is expert of',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User ID to match on the tag expert')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within tag expert'),\n }),\n apply: (resource: Collection, { userRef, claims }) => {\n return Boolean(\n resource?.experts?.some(e => e === userRef || claims?.includes(e)),\n );\n },\n toQuery: ({ claims = [], userRef }) => {\n return {\n property: 'tag.experts' as CollectionFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const collectionTagExpertConditionFactory = createConditionFactory(\n isCollectionTagExpert,\n);\n\nexport const collectionDoesNotHaveTags = createPermissionRule({\n name: 'DOES_NOT_HAVE_TAGS',\n description:\n 'Should allow only if the posts in the collection do not have any of the specific tags',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n tags: z\n .array(z.string())\n .describe('Tags that should not be in the collection'),\n }),\n apply: (resource: Collection, { tags }) => {\n return !tags.some(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n not: {\n property: 'tags' as CollectionFilter['property'],\n values: tags,\n },\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionDoesNotHaveTagsConditionFactory = createConditionFactory(\n collectionDoesNotHaveTags,\n);\n\nexport const collectionDoesNotHaveEntities = createPermissionRule({\n name: 'DOES_NOT_HAVE_ENTITIES',\n description:\n 'Should allow only if the posts in the collection do not have any of the specific entities',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs that should not be in the collection'),\n }),\n apply: (resource: Collection, { entityRefs }) => {\n return !entityRefs.some(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n not: {\n property: 'entityRefs' as CollectionFilter['property'],\n values: entityRefs,\n },\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionDoesNotHaveEntitiesConditionFactory =\n createConditionFactory(collectionDoesNotHaveEntities);\n\nexport const collectionRules = {\n isCollectionOwner,\n collectionHasTags,\n collectionHasAnyTag,\n collectionHasEntities,\n collectionHasAnyEntity,\n isCollectionTagExpert,\n collectionDoesNotHaveTags,\n collectionDoesNotHaveEntities,\n};\n\nexport const rules = {\n ...commentRules,\n ...answerRules,\n ...postRules,\n ...tagRules,\n ...collectionRules,\n};\n"],"names":["createPermissionRule","postPermissionResourceRef","z","createConditionFactory","answerPermissionResourceRef","commentPermissionResourceRef","tagPermissionResourceRef","collectionPermissionResourceRef"],"mappings":";;;;;;AA0BO,MAAM,eAAeA,yCAAqB,CAAA;AAAA,EAC/C,IAAM,EAAA,WAAA;AAAA,EACN,WAAa,EAAA,sDAAA;AAAA,EACb,WAAa,EAAAC,6CAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,SAASA,KAAE,CAAA,MAAA,GAAS,QAAS,CAAA,gCAAgC,EAAE,QAAS,EAAA;AAAA,IACxE,MAAA,EAAQA,KACL,CAAA,KAAA,CAAMA,KAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,uDAAuD;AAAA,GACpE,CAAA;AAAA,EACD,KAAA,EAAO,CAAC,QAAgB,EAAA,EAAE,SAAS,MAAS,GAAA,IAAS,KAAA;AACnD,IAAA,OAAO,UAAU,MAAW,KAAA,OAAA,IAAW,MAAO,CAAA,QAAA,CAAS,UAAU,MAAM,CAAA;AAAA,GACzE;AA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A;AAAA,EACH,GAAG,QAAA;AAAA,EACH,GAAG;AACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"permissionRules.cjs.js","sources":["../src/permissionRules.ts"],"sourcesContent":["import {\n createConditionFactory,\n createPermissionRule,\n} from '@backstage/plugin-permission-node';\nimport { z } from 'zod/v3';\nimport {\n Answer,\n AnswerFilter,\n Collection,\n CollectionFilter,\n Comment,\n CommentFilter,\n Post,\n PostFilter,\n TagFilter,\n TagResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport {\n answerPermissionResourceRef,\n collectionPermissionResourceRef,\n commentPermissionResourceRef,\n postPermissionResourceRef,\n tagPermissionResourceRef,\n} from './permissionResources';\nimport { PermissionCriteria } from '@backstage/plugin-permission-common';\n\nexport const isPostAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the post is created by the user',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Post, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'posts.author' as PostFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const postAuthorConditionFactory = createConditionFactory(isPostAuthor);\n\nexport const postHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description: 'Should allow only if the post has all the specific tags',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the post'),\n }),\n apply: (resource: Post, { tags }) => {\n return tags.every(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n const filters: PermissionCriteria<PostFilter>[] = tags.map(e => ({\n property: 'tags' as PostFilter['property'],\n values: [e],\n }));\n\n return {\n allOf: filters,\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postHasTagsConditionFactory = createConditionFactory(postHasTags);\n\nexport const postHasAnyTag = createPermissionRule({\n name: 'HAS_ANY_TAG',\n description: 'Should allow only if the post has any of the specific tags',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the post'),\n }),\n apply: (resource: Post, { tags }) => {\n return tags.some(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as PostFilter['property'],\n values: tags,\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postHasAnyTagConditionFactory =\n createConditionFactory(postHasAnyTag);\n\nexport const postHasEntities = createPermissionRule({\n name: 'HAS_ENTITIES',\n description: 'Should allow only if the post has all the specific entities',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Entity refs to match the post'),\n }),\n apply: (resource: Post, { entityRefs }) => {\n return entityRefs.every(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }): PermissionCriteria<PostFilter> => {\n const filters: PermissionCriteria<PostFilter>[] = entityRefs.map(e => ({\n property: 'entityRefs' as PostFilter['property'],\n values: [e],\n }));\n\n return {\n allOf: filters,\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postHasEntitiesConditionFactory =\n createConditionFactory(postHasEntities);\n\nexport const postHasAnyEntity = createPermissionRule({\n name: 'HAS_ANY_ENTITY',\n description: 'Should allow only if the post has any of the specific entities',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Entity refs to match the post'),\n }),\n apply: (resource: Post, { entityRefs }) => {\n return entityRefs.some(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }): PermissionCriteria<PostFilter> => {\n return {\n property: 'entityRefs' as PostFilter['property'],\n values: entityRefs,\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postHasAnyEntityConditionFactory =\n createConditionFactory(postHasAnyEntity);\n\nexport const postHasType = createPermissionRule({\n name: 'HAS_TYPE',\n description: 'Should allow only if the post has the specific type',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n type: z.string().describe('Type to match the post'),\n }),\n apply: (resource: Post, { type }) => {\n return resource?.type === type;\n },\n toQuery: ({ type }) => {\n return {\n property: 'posts.type' as PostFilter['property'],\n values: [type],\n };\n },\n});\n\nexport const postHasTypeConditionFactory = createConditionFactory(postHasType);\n\nexport const isPostTagExpert = createPermissionRule({\n name: 'IS_POST_TAG_EXPERT',\n description: 'Allows if post has tags the user is expert of',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User ID to match on the tag expert')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within tag expert'),\n }),\n apply: (resource: Post, { userRef, claims }) => {\n return Boolean(\n resource?.experts?.some(e => e === userRef || claims?.includes(e)),\n );\n },\n toQuery: ({ claims = [], userRef }) => {\n return {\n property: 'tag.experts' as PostFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const postTagExpertConditionFactory =\n createConditionFactory(isPostTagExpert);\n\nexport const postDoesNotHaveTags = createPermissionRule({\n name: 'DOES_NOT_HAVE_TAGS',\n description:\n 'Should allow only if the post does not have any of the specific tags',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tags that should not be on the post'),\n }),\n apply: (resource: Post, { tags }) => {\n return !tags.some(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n not: {\n property: 'tags' as PostFilter['property'],\n values: tags,\n },\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postDoesNotHaveTagsConditionFactory =\n createConditionFactory(postDoesNotHaveTags);\n\nexport const postDoesNotHaveEntities = createPermissionRule({\n name: 'DOES_NOT_HAVE_ENTITIES',\n description:\n 'Should allow only if the post does not have any of the specific entities',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs that should not be on the post'),\n }),\n apply: (resource: Post, { entityRefs }) => {\n return !entityRefs.some(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }): PermissionCriteria<PostFilter> => {\n return {\n not: {\n property: 'entityRefs' as PostFilter['property'],\n values: entityRefs,\n },\n } as PermissionCriteria<PostFilter>;\n },\n});\n\nexport const postDoesNotHaveEntitiesConditionFactory = createConditionFactory(\n postDoesNotHaveEntities,\n);\n\nexport const postRules = {\n isPostAuthor,\n postHasTags,\n postHasAnyTag,\n postHasEntities,\n postHasAnyEntity,\n postHasType,\n isPostTagExpert,\n postDoesNotHaveTags,\n postDoesNotHaveEntities,\n};\n\nexport const isAnswerAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the answer is created by the user',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Answer, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'answers.author' as AnswerFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const answerAuthorConditionFactory =\n createConditionFactory(isAnswerAuthor);\n\nexport const answerQuestionHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description:\n 'Should allow only if the answers question has all the specific tags',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { tags }) => {\n return tags.every(t => resource?.post?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n const filters: PermissionCriteria<AnswerFilter>[] = tags.map(e => ({\n property: 'tags' as AnswerFilter['property'],\n values: [e],\n }));\n\n return {\n allOf: filters,\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionTagsConditionFactory = createConditionFactory(\n answerQuestionHasTags,\n);\n\nexport const answerQuestionHasAnyTag = createPermissionRule({\n name: 'HAS_ANY_TAG',\n description:\n 'Should allow only if the answers question has any of the specific tags',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { tags }) => {\n return tags.some(t => resource?.post?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as AnswerFilter['property'],\n values: tags,\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionAnyTagConditionFactory = createConditionFactory(\n answerQuestionHasAnyTag,\n);\n\nexport const answerQuestionHasEntityRefs = createPermissionRule({\n name: 'HAS_ENTITIES',\n description:\n 'Should allow only if the answers question has all the specific entities',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { entityRefs }) => {\n return entityRefs.every(t => resource?.post?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n const filters: PermissionCriteria<AnswerFilter>[] = entityRefs.map(e => ({\n property: 'entityRefs' as AnswerFilter['property'],\n values: [e],\n }));\n\n return {\n allOf: filters,\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionEntitiesConditionFactory = createConditionFactory(\n answerQuestionHasEntityRefs,\n);\n\nexport const answerQuestionHasAnyEntityRefs = createPermissionRule({\n name: 'HAS_ANY_ENTITIES',\n description:\n 'Should allow only if the answers question has any of the specific entities',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { entityRefs }) => {\n return entityRefs.some(t => resource?.post?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n property: 'entityRefs' as AnswerFilter['property'],\n values: entityRefs,\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionHasAnyEntitiesConditionFactory =\n createConditionFactory(answerQuestionHasEntityRefs);\n\nexport const isAnswerTagExpert = createPermissionRule({\n name: 'IS_ANSWER_TAG_EXPERT',\n description: 'Allows if answers post has tags the user is expert of',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User ID to match on the tag expert')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within tag expert'),\n }),\n apply: (resource: Answer, { userRef, claims }) => {\n return Boolean(\n resource?.experts?.some(e => e === userRef || claims?.includes(e)),\n );\n },\n toQuery: ({ claims = [], userRef }) => {\n return {\n property: 'tag.experts' as AnswerFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const answerTagExpertConditionFactory =\n createConditionFactory(isAnswerTagExpert);\n\nexport const answerQuestionDoesNotHaveTags = createPermissionRule({\n name: 'DOES_NOT_HAVE_TAGS',\n description:\n 'Should allow only if the answers question does not have any of the specific tags',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n tags: z\n .array(z.string())\n .describe('Tags that should not be on the question'),\n }),\n apply: (resource: Answer, { tags }) => {\n return !tags.some(t => resource?.post?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n not: {\n property: 'tags' as AnswerFilter['property'],\n values: tags,\n },\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionDoesNotHaveTagsConditionFactory =\n createConditionFactory(answerQuestionDoesNotHaveTags);\n\nexport const answerQuestionDoesNotHaveEntityRefs = createPermissionRule({\n name: 'DOES_NOT_HAVE_ENTITIES',\n description:\n 'Should allow only if the answers question does not have any of the specific entities',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs that should not be on the question'),\n }),\n apply: (resource: Answer, { entityRefs }) => {\n return !entityRefs.some(t => resource?.post?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n not: {\n property: 'entityRefs' as AnswerFilter['property'],\n values: entityRefs,\n },\n } as PermissionCriteria<AnswerFilter>;\n },\n});\n\nexport const answerQuestionDoesNotHaveEntitiesConditionFactory =\n createConditionFactory(answerQuestionDoesNotHaveEntityRefs);\n\nexport const answerRules = {\n isAnswerAuthor,\n answerQuestionHasTags,\n answerQuestionHasAnyTag,\n answerQuestionHasEntityRefs,\n answerQuestionHasAnyEntityRefs,\n isAnswerTagExpert,\n answerQuestionDoesNotHaveTags,\n answerQuestionDoesNotHaveEntityRefs,\n};\n\nexport const isCommentAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the comment is created by the user',\n resourceRef: commentPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Comment, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'comments.author' as CommentFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const commentAuthorConditionFactory =\n createConditionFactory(isCommentAuthor);\n\nexport const commentRules = { isCommentAuthor };\n\nexport const isTag = createPermissionRule({\n name: 'IS_TAG',\n description: 'Should allow only if the tag exists',\n resourceRef: tagPermissionResourceRef,\n paramsSchema: z.object({\n tag: z.string().describe('Tag to match the post'),\n }),\n apply: (resource: TagResponse, { tag }) => {\n return resource?.tag === tag;\n },\n toQuery: ({ tag }) => {\n return {\n property: 'tags.tag' as TagFilter['property'],\n values: [tag],\n };\n },\n});\n\nexport const tagConditionFactory = createConditionFactory(isTag);\n\nexport const isTagExpert = createPermissionRule({\n name: 'IS_TAG_EXPERT',\n description: 'Allows only if user is tag expert',\n resourceRef: tagPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User ID to match on the tag expert')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within tag expert'),\n }),\n apply: (resource: TagResponse, { userRef, claims }) => {\n return Boolean(\n resource?.experts?.some(e => e === userRef || claims?.includes(e)),\n );\n },\n toQuery: ({ claims = [], userRef }) => {\n return {\n property: 'tag.experts' as TagFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const tagExpertConditionFactory = createConditionFactory(isTagExpert);\n\nexport const tagRules = { isTag, isTagExpert };\n\nexport const isCollectionOwner = createPermissionRule({\n name: 'IS_OWNER',\n description: 'Should allow only if the collection is owned by the user',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User reference to match on the owner')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within owner'),\n }),\n apply: (resource: Collection, { userRef, claims = [] }) => {\n return resource?.owner === userRef || claims.includes(resource?.owner);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'collections.owner' as CollectionFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const collectionOwnerConditionFactory =\n createConditionFactory(isCollectionOwner);\n\nexport const collectionHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description:\n 'Should allow only if the posts in the collection have the specific tags',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the collection'),\n }),\n apply: (resource: Collection, { tags }) => {\n return tags.every(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n const filters: PermissionCriteria<CollectionFilter>[] = tags.map(e => ({\n property: 'tags' as CollectionFilter['property'],\n values: [e],\n }));\n\n return {\n allOf: filters,\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionHasTagsConditionFactory =\n createConditionFactory(collectionHasTags);\n\nexport const collectionHasAnyTag = createPermissionRule({\n name: 'HAS_ANY_TAG',\n description:\n 'Should allow only if the posts in the collection have some of the specific tags',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the collection'),\n }),\n apply: (resource: Collection, { tags }) => {\n return tags.some(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as CollectionFilter['property'],\n values: tags,\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionHasAnyTagConditionFactory =\n createConditionFactory(collectionHasAnyTag);\n\nexport const collectionHasEntities = createPermissionRule({\n name: 'HAS_ENTITIES',\n description:\n 'Should allow only if the posts in the collection have all the specific entities',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs to match the collection'),\n }),\n apply: (resource: Collection, { entityRefs }) => {\n return entityRefs.every(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n const filters: PermissionCriteria<CollectionFilter>[] = entityRefs.map(\n e => ({\n property: 'entityRefs' as CollectionFilter['property'],\n values: [e],\n }),\n );\n\n return {\n allOf: filters,\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionHasEntitiesConditionFactory = createConditionFactory(\n collectionHasEntities,\n);\n\nexport const collectionHasAnyEntity = createPermissionRule({\n name: 'HAS_ANY_ENTITY',\n description:\n 'Should allow only if the posts in the collection have some of the specific entities',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs to match the collection'),\n }),\n apply: (resource: Collection, { entityRefs }) => {\n return entityRefs.some(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n property: 'entityRefs' as CollectionFilter['property'],\n values: entityRefs,\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionHasAnyEntityConditionFactory = createConditionFactory(\n collectionHasAnyEntity,\n);\n\nexport const isCollectionTagExpert = createPermissionRule({\n name: 'IS_COLLECTION_TAG_EXPERT',\n description: 'Allows if collection has tags the user is expert of',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User ID to match on the tag expert')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within tag expert'),\n }),\n apply: (resource: Collection, { userRef, claims }) => {\n return Boolean(\n resource?.experts?.some(e => e === userRef || claims?.includes(e)),\n );\n },\n toQuery: ({ claims = [], userRef }) => {\n return {\n property: 'tag.experts' as CollectionFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const collectionTagExpertConditionFactory = createConditionFactory(\n isCollectionTagExpert,\n);\n\nexport const collectionDoesNotHaveTags = createPermissionRule({\n name: 'DOES_NOT_HAVE_TAGS',\n description:\n 'Should allow only if the posts in the collection do not have any of the specific tags',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n tags: z\n .array(z.string())\n .describe('Tags that should not be in the collection'),\n }),\n apply: (resource: Collection, { tags }) => {\n return !tags.some(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n not: {\n property: 'tags' as CollectionFilter['property'],\n values: tags,\n },\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionDoesNotHaveTagsConditionFactory = createConditionFactory(\n collectionDoesNotHaveTags,\n);\n\nexport const collectionDoesNotHaveEntities = createPermissionRule({\n name: 'DOES_NOT_HAVE_ENTITIES',\n description:\n 'Should allow only if the posts in the collection do not have any of the specific entities',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs that should not be in the collection'),\n }),\n apply: (resource: Collection, { entityRefs }) => {\n return !entityRefs.some(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n not: {\n property: 'entityRefs' as CollectionFilter['property'],\n values: entityRefs,\n },\n } as PermissionCriteria<CollectionFilter>;\n },\n});\n\nexport const collectionDoesNotHaveEntitiesConditionFactory =\n createConditionFactory(collectionDoesNotHaveEntities);\n\nexport const collectionRules = {\n isCollectionOwner,\n collectionHasTags,\n collectionHasAnyTag,\n collectionHasEntities,\n collectionHasAnyEntity,\n isCollectionTagExpert,\n collectionDoesNotHaveTags,\n collectionDoesNotHaveEntities,\n};\n\nexport const rules = {\n ...commentRules,\n ...answerRules,\n ...postRules,\n ...tagRules,\n ...collectionRules,\n};\n"],"names":["createPermissionRule","postPermissionResourceRef","z","createConditionFactory","answerPermissionResourceRef","commentPermissionResourceRef","tagPermissionResourceRef","collectionPermissionResourceRef"],"mappings":";;;;;;AA0BO,MAAM,eAAeA,yCAAA,CAAqB;AAAA,EAC/C,IAAA,EAAM,WAAA;AAAA,EACN,WAAA,EAAa,sDAAA;AAAA,EACb,WAAA,EAAaC,6CAAA;AAAA,EACb,YAAA,EAAcC,KAAE,MAAA,CAAO;AAAA,IACrB,SAASA,IAAA,CAAE,MAAA,GAAS,QAAA,CAAS,gCAAgC,EAAE,QAAA,EAAS;AAAA,IACxE,MAAA,EAAQA,IAAA,CACL,KAAA,CAAMA,IAAA,CAAE,MAAA,EAAQ,CAAA,CAChB,QAAA,EAAS,CACT,QAAA,CAAS,uDAAuD;AAAA,GACpE,CAAA;AAAA,EACD,KAAA,EAAO,CAAC,QAAA,EAAgB,EAAE,SAAS,MAAA,GAAS,IAAG,KAAM;AACnD,IAAA,OAAO,UAAU,MAAA,KAAW,OAAA,IAAW,MAAA,CAAO,QAAA,CAAS,UAAU,MAAM,CAAA;AAAA,EACzE,CAAA;AAAA,EACA,SAAS,CAAC,EAAE,SAAS,MAAA,GAAS,IAAG,KAAM;AACrC,IAAA,OAAO;AAAA,MACL,QAAA,EAAU,cAAA;AAAA,MACV,QAAQ,CAAC,OAAA,EAAS,GAAG,MAAM,CAAA,CAAE,OAAO,OAAO;AAAA,KAC7C;AAAA,EACF;AACF,CAAC;AAEM,MAAM,0BAAA,GAA6BC,4CAAuB,YAAY;AAEtE,MAAM,cAAcH,yCAAA,CAAqB;AAAA,EAC9C,IAAA,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"backstage.io",
|
|
8
8
|
"node"
|
|
9
9
|
],
|
|
10
|
-
"version": "3.59.
|
|
10
|
+
"version": "3.59.5",
|
|
11
11
|
"main": "dist/index.cjs.js",
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
13
|
"prepublishOnly": "yarn tsc && yarn build",
|
|
@@ -47,20 +47,20 @@
|
|
|
47
47
|
"tsc": "tsc"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@backstage/cli": "^0.
|
|
50
|
+
"@backstage/cli": "^0.36.1"
|
|
51
51
|
},
|
|
52
52
|
"files": [
|
|
53
53
|
"dist"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@backstage/backend-plugin-api": "^1.
|
|
57
|
-
"@backstage/catalog-model": "^1.
|
|
58
|
-
"@backstage/config": "^1.3.
|
|
59
|
-
"@backstage/plugin-auth-node": "^0.
|
|
60
|
-
"@backstage/plugin-permission-common": "^0.9.
|
|
61
|
-
"@backstage/plugin-permission-node": "^0.10.
|
|
62
|
-
"@drodil/backstage-plugin-qeta-common": "^3.59.
|
|
63
|
-
"zod": "^
|
|
56
|
+
"@backstage/backend-plugin-api": "^1.9.0",
|
|
57
|
+
"@backstage/catalog-model": "^1.8.0",
|
|
58
|
+
"@backstage/config": "^1.3.7",
|
|
59
|
+
"@backstage/plugin-auth-node": "^0.7.0",
|
|
60
|
+
"@backstage/plugin-permission-common": "^0.9.8",
|
|
61
|
+
"@backstage/plugin-permission-node": "^0.10.12",
|
|
62
|
+
"@drodil/backstage-plugin-qeta-common": "^3.59.5",
|
|
63
|
+
"zod": "^4.0.0"
|
|
64
64
|
},
|
|
65
65
|
"typesVersions": {
|
|
66
66
|
"*": {
|