且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Jenkins-如何基于项目设置授权

更新时间:2023-02-17 12:46:49

我同意基于项目的解决方案"可以解决您的问题,但是如果将来您有100个用户,它将使管理员感到头疼. 然后,对于每个用户,您都必须授予权限,这对于面对基于角色的插件存在问题的用户来说将是很大的努力. 解决方法如下:-

I agree Project Based could solve your problem but it would create headache on administrator if going forward you have 100 users. Then For each user you have to give permissions,which will be a lot of effort and for those who are facing issues with Role based plugin. Here is the solution:-

步骤1:-单击管理Jenkins"下的全局配置".

Step 1:- click on Global configuration under Manage Jenkins.

第2步:-单击基于角色的策略"单选按钮并保存.

Step 2:- click on radio button "Role-Based Strategy" and save.

第3步:-转到管理詹金斯"下的管理和分配角色".

Step 3:- Go to Manage and Assign Roles under Manage Jenkins.

第4步:-选择管理角色".

Step 4:- select Manage Roles.

第5步:-您会看到与

步骤6:-现在,在角色添加"选项下,从admin添加全局角色部分,并授予只读权限.以蓝色显示

Step 6:- Now add a global role part from admin under "role to add" option and grant Read Permission only.Shown in Blue color

例如:-在这种情况下为员工

For eg:- Employee in this case

第7步:-对于上述问题和以下示例,一些假设

Step 7:- For the above question and below example some assumptions

Test = Project1
check = Project2

在项目中的角色:-

 Role to add:-developer

 Pattern:-Test

这意味着开发人员将只能查看测试"项目.

This means developer will be able to view only Project "Test".

模式基本上是您的项目名称.您也可以在此处使用正则表达式.例如: 模式:-Tes * 那么所有以Tes开头的项目都将扮演开发人员的角色.

Pattern is basically your project name.You can use regular expressions also here. For eg:- Pattern:- Tes* then all projects beginning with Tes will have role as developer.

类似地,添加角色作为测试员,并添加模式作为选中项,显示在黑框下,测试员将只能查看项目选中项"

Similarly Add role as tester and Pattern as check,shown under black box,Tester will be able to view only Project "check"

第8步:-通过复选框提供相应的权限视图,构建等,然后单击保存.

Step 8:- Give the respective permissions view,build etc by check boxes and click on save.

第9步:-现在回到管理角色"并选择分配角色",您将发现与此类似的内容.

Step 9:- Now go back to Manage Roles and select assign role and you will find something similar to this.

步骤10:-在全局角色下,将user1和user2添加到Employee复选框上,如上图黑框所示.

Step 10:- Under Global role add user1 and user2 and check box on to Employee as their role as shown in in the image above in black box.

[NOTE]必须在此处添加每个新用户/组,并赋予其员工或管理员角色.

[NOTE]Every New User/Group has to be added here and given the role of employee or admin.

步骤11:-在项目角色"下,

Step 11:- Under Project Role,

添加user1和user2并将它们分配给测试人员和开发人员角色. 如绿色所示.

Add user1 and user2 and assign them tester and developer role. As shown in green color.

点击保存.

[注意]

Developer will be able to view only Project "Test"
tester will be able to view only  Project "check"