Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
roginluo
Jenkins
提交
bd2ccfb0
J
Jenkins
项目概览
roginluo
/
Jenkins
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
Jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bd2ccfb0
编写于
4月 15, 2017
作者:
O
Oleg Nenashev
提交者:
GitHub
4月 15, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2835 from olivergondza/fixup-provision-perm
[FIXED JENKINS-37616] Make sure Cloud.PROVISION is properly initialized
上级
d7d36b30
d35dfcb2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
1 deletion
+20
-1
core/src/main/java/hudson/model/Computer.java
core/src/main/java/hudson/model/Computer.java
+6
-0
test/src/test/java/hudson/slaves/CloudTest.java
test/src/test/java/hudson/slaves/CloudTest.java
+14
-1
未找到文件。
core/src/main/java/hudson/model/Computer.java
浏览文件 @
bd2ccfb0
...
...
@@ -29,6 +29,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import
hudson.EnvVars
;
import
hudson.Extension
;
import
hudson.Launcher.ProcStarter
;
import
hudson.slaves.Cloud
;
import
jenkins.util.SystemProperties
;
import
hudson.Util
;
import
hudson.cli.declarative.CLIMethod
;
...
...
@@ -1747,5 +1748,10 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
public
static
final
Permission
CONNECT
=
new
Permission
(
PERMISSIONS
,
"Connect"
,
Messages
.
_Computer_ConnectPermission_Description
(),
DISCONNECT
,
PermissionScope
.
COMPUTER
);
public
static
final
Permission
BUILD
=
new
Permission
(
PERMISSIONS
,
"Build"
,
Messages
.
_Computer_BuildPermission_Description
(),
Permission
.
WRITE
,
PermissionScope
.
COMPUTER
);
// This permission was historically scoped to this class albeit declared in Cloud. While deserializing, Jenkins loads
// the scope class to make sure the permission is initialized and registered. since Cloud class is used rather seldom,
// it might appear the permission does not exist. Referencing the permission from here to make sure it gets loaded.
private
static
final
@Deprecated
Permission
CLOUD_PROVISION
=
Cloud
.
PROVISION
;
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
Computer
.
class
.
getName
());
}
core
/src/test/java/hudson/slaves/CloudTest.java
→
test
/src/test/java/hudson/slaves/CloudTest.java
浏览文件 @
bd2ccfb0
...
...
@@ -7,11 +7,17 @@ import hudson.security.Permission;
import
hudson.security.SidACL
;
import
jenkins.model.Jenkins
;
import
org.acegisecurity.acls.sid.Sid
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.jvnet.hudson.test.Issue
;
import
org.jvnet.hudson.test.JenkinsRule
;
import
org.jvnet.hudson.test.WithoutJenkins
;
public
class
CloudTest
{
@Test
@Rule
public
JenkinsRule
j
=
new
JenkinsRule
();
@Test
@WithoutJenkins
@Issue
(
"JENKINS-37616"
)
public
void
provisionPermissionShouldBeIndependentFromAdminister
()
throws
Exception
{
SidACL
acl
=
new
SidACL
()
{
@Override
protected
Boolean
hasPermission
(
Sid
p
,
Permission
permission
)
{
...
...
@@ -23,4 +29,11 @@ public class CloudTest {
assertFalse
(
acl
.
hasPermission
(
Jenkins
.
ANONYMOUS
,
Jenkins
.
ADMINISTER
));
assertEquals
(
Cloud
.
PROVISION
,
Computer
.
PERMISSIONS
.
find
(
"Provision"
));
}
@Test
@Issue
(
"JENKINS-37616"
)
public
void
ensureProvisionPermissionIsLoadable
()
throws
Exception
{
// Name introduced by JENKINS-37616
Permission
p
=
Permission
.
fromId
(
"hudson.model.Computer.Provision"
);
assertEquals
(
"Provision"
,
p
.
name
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录