背景
Jenkins通常使用插件Role-based Authorization Strategy管理用户权限,
问题描述
手贱误删了自己的admin用户
误删admin页面各种点击、搜索均无响应,
页面无响应尝试登录账号,报403错误
login报403错误补救措施
Jenkins的配置信息存放在工作空间/config.xml
中,下面是其中关于Role-based Authorization Strategy
插件的内容:
<useSecurity>true</useSecurity>
<authorizationStrategy class="com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy">
<roleMap type="globalRoles">
<role name="admin" pattern=".*">
<permissions>
<permission>hudson.model.Hudson.Read</permission>
<permission>hudson.model.View.Delete</permission>
<permission>hudson.model.Computer.Connect</permission>
<permission>hudson.model.Item.Create</permission>
<permission>hudson.model.Item.Workspace</permission>
<permission>hudson.model.Computer.Create</permission>
<permission>hudson.model.View.Configure</permission>
<permission>hudson.model.Computer.Provision</permission>
<permission>hudson.model.Computer.Build</permission>
<permission>hudson.model.Item.Configure</permission>
<permission>hudson.model.View.Read</permission>
<permission>hudson.model.View.Create</permission>
<permission>hudson.model.Hudson.Administer</permission>
<permission>hudson.model.Item.Cancel</permission>
<permission>hudson.model.Item.Delete</permission>
<permission>hudson.model.Item.Read</permission>
<permission>hudson.model.Computer.Configure</permission>
<permission>hudson.model.Computer.Delete</permission>
<permission>hudson.model.Item.Build</permission>
<permission>hudson.model.Computer.Disconnect</permission>
<permission>hudson.model.Item.Discover</permission>
</permissions>
<assignedSIDs>
<sid>anonymous</sid>
</assignedSIDs>
</role>
<role name="ops" pattern=".*">
<permissions>
<permission>hudson.model.Hudson.Read</permission>
<permission>hudson.model.View.Delete</permission>
<permission>hudson.model.Item.Create</permission>
<permission>hudson.model.Item.Workspace</permission>
<permission>hudson.model.View.Configure</permission>
<permission>hudson.model.Item.Configure</permission>
<permission>hudson.model.View.Read</permission>
<permission>hudson.model.View.Create</permission>
<permission>hudson.model.Item.Cancel</permission>
<permission>hudson.model.Item.Delete</permission>
<permission>hudson.model.Item.Read</permission>
<permission>hudson.model.Item.Build</permission>
<permission>hudson.model.Item.Discover</permission>
</permissions>
<assignedSIDs/>
</role>
<role name="other" pattern=".*">
<permissions>
<permission>hudson.model.Hudson.Read</permission>
</permissions>
<assignedSIDs/>
</role>
</roleMap>
<roleMap type="slaveRoles"/>
<roleMap type="projectRoles"/>
</authorizationStrategy>
只要将相应的roleMap下的role添加回来,并重启Jenkins服务即可。
网友评论