jenkins 創建用戶角色項目權限

原文鏈接:https://blog.csdn.net/u013066244/article/details/53407985

安裝Role-Based Strategy插件


插件的官網文檔

1、安裝插件後,進入系統設置頁面,配置如下:

保存之後,再點擊 系統管理頁面點擊Manage and Assign Roles進入角色管理頁面:

1、管理角色(Manage Roles) 
2、角色權限配置

這裏我們暫時回到系統管理 – 管理用戶:

點擊新建用戶:

如果之前有項目與scm版本管理系統(如svn、git等)連接並獲取源碼構建過,jenkins會從svn中讀取到一些用戶信息,可以在查看用戶菜單中看到這些用戶

點擊相應的用戶標識後,再點擊 設置按鈕,可以修改密碼等個人信息。

之後我們再回到Manage and Assign Roles –> Manage Roles:

關於pattern處的填寫:

官方文檔介紹該選項支持正則表達式,如Roger-.表示所有以Roger-開頭的項目, 
(?i)roger-.*表示以roger-開頭的項目並且不區分大小寫, 
如以ABC開頭的項目可以配置爲ABC|ABC.*, 
官方文檔> https://wiki.jenkins-ci.org/display/JENKINS/Role+Strategy+Plugin

我們再來配置Assign Roles

系統配置 – Manage and Assign Roles – Assign Roles

點擊保存後,就OK了。 
以爲上面的例子爲例,用戶名zhougz登錄後只能看到項目名爲ggindex的項目。

由於jenkins是英文,所以最好賦上一張jenkins權限的圖;

Pattern處詳解
There's nothing much to say here, this is self-explanatory. The only tricky field is the Pattern one. This field consists in a regular expression aimed at matching the full name (including the folder name, if you're using Cloudbees Folders Plugin) of the jobs which the role will apply to. For example, if you set the field to "Roger-.*", then the role will match all jobs which name starts with "Roger-". Note that the pattern is case-sensitive. To perform a case-insensitive match, use (?i) notation: upper, "Roger-.*" vs. lower, "roger-.*" vs. case-insensitive, "(?i)roger-.*". If you have a nested folder structure where you want to provide the particular access to the second folder (or deeper), consider having a two-level security structure as well (Say you want to provide exclusive write/ modify type access to foo/bar and not everything else under "foo": First, assign that user/ group to read/ discover permissions with pattern " ^foo.* ", then assign that same user/ group to the more particular permissions with pattern " ^foo/bar.* " - Similar to what you'd do in a Unix/ Linux environment.
1
中文意思:

這沒什麼好說的,已經不言而喻啦!這裏唯一棘手的事情就是Pattern。這個pattern是在於針對匹配正則表達式的全名(包括文件夾的名稱,如果你使用Cloudbees文件夾插件)將適用於的工作角色。例如:如果你在pattern處輸入“Roger-.*”,這個角色將匹配所有jobs中name以”Roger-“開頭。注意,這個正則表達式區別大小寫的。要是不想區分大小寫, 
可以使用(?i)符號:首字母大寫”Roger-.” vs 小寫”roger-.” vs 不區別大小寫 
“(?i)roger-.*”。 
如果你有一個嵌套文件夾結構,你需要提供特定的訪問第二個文件夾(或深度),考慮有兩級安全結構(說你想提供獨家編寫/修改類型訪問foo / bar和沒有其他“foo”:首先,分配用戶/組讀/發現權限模式”^ foo。”,然後分配相同的用戶/組的更特定的權限模式”^ foo / bar。”——類似於Unix / Linux環境中你會做什麼。

參考地址

https://wiki.jenkins-ci.org/display/JENKINS/Role+Strategy+Plugin 
http://www.cnblogs.com/love19791125/p/5113980.html 
http://www.cnblogs.com/davidwang456/p/3701972.html 
http://www.cnblogs.com/zz0412/p/jenkins_jj_14.html
 ———————————————— 
版權聲明:本文爲CSDN博主「山鬼謠me」的原創文章,遵循CC 4.0 by-sa版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/u013066244/article/details/53407985

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章