(feature): enable permissions in jenkins plugin. Actions (re-build) can be executed only by a user who owns the entity (or related group own the entity)

Signed-off-by: Hasan Oezdemir <21654050+nodify-at@users.noreply.github.com>
This commit is contained in:
Hasan Oezdemir
2022-02-27 01:58:56 +01:00
parent 3b7a11e9c8
commit 23e1c17bba
20 changed files with 317 additions and 3 deletions
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
extends: [require.resolve('@backstage/cli/config/eslint')],
};
+3
View File
@@ -0,0 +1,3 @@
# Jenkins Common
Shared isomorphic code for the jenkins plugin.
+15
View File
@@ -0,0 +1,15 @@
## API Report File for "@backstage/plugin-jenkins-common"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { Permission } from '@backstage/plugin-permission-common';
// @public
export const jenkinsExecutePermission: Permission;
// @public (undocumented)
export const RESOURCE_TYPE_JENKINS = 'jenkins';
// (No @packageDocumentation comment for this package)
```
+33
View File
@@ -0,0 +1,33 @@
{
"name": "@backstage/plugin-jenkins-common",
"version": "0.1.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "common-library"
},
"scripts": {
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack",
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/plugin-permission-common": "^0.5.1"
},
"devDependencies": {
"@backstage/cli": "^0.14.1"
},
"files": [
"dist"
]
}
+16
View File
@@ -0,0 +1,16 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './permissions';
+34
View File
@@ -0,0 +1,34 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Permission } from '@backstage/plugin-permission-common';
/**
* @public
*/
export const RESOURCE_TYPE_JENKINS = 'jenkins';
/**
* This permission is used to determine if a user is allowed to execute an action in jenkins plugin
*
* @public
*/
export const jenkinsExecutePermission: Permission = {
name: 'jenkins.execute',
attributes: {
action: 'update',
},
resourceType: RESOURCE_TYPE_JENKINS,
};