Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
8d438b7b
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8d438b7b
编写于
6月 08, 2018
作者:
O
Oleg Nenashev
提交者:
GitHub
6月 08, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3460 from oleg-nenashev/feature/JENKINS-51598-PerissionAPI
[JENKINS-51598] - Expose PermissionGroup IDs to API
上级
a846c366
7de5f7d0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
6 deletion
+29
-6
core/src/main/java/hudson/security/PermissionGroup.java
core/src/main/java/hudson/security/PermissionGroup.java
+29
-6
未找到文件。
core/src/main/java/hudson/security/PermissionGroup.java
浏览文件 @
8d438b7b
...
...
@@ -27,6 +27,7 @@ import hudson.model.Hudson;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.SortedSet
;
import
java.util.TreeSet
;
import
javax.annotation.CheckForNull
;
...
...
@@ -51,6 +52,8 @@ public final class PermissionGroup implements Iterable<Permission>, Comparable<P
*/
public
final
Localizable
title
;
private
final
String
id
;
/**
* Both creates a registers a new permission group.
* @param owner sets {@link #owner}
...
...
@@ -58,12 +61,32 @@ public final class PermissionGroup implements Iterable<Permission>, Comparable<P
* @throws IllegalStateException if this group was already registered
*/
public
PermissionGroup
(
@Nonnull
Class
owner
,
Localizable
title
)
throws
IllegalStateException
{
this
(
title
.
toString
(
Locale
.
ENGLISH
),
owner
,
title
);
}
/**
* Both creates a registers a new permission group.
* @param owner sets {@link #owner}
* @param title sets {@link #title}
* @throws IllegalStateException if this group was already registered
* @since TODO
*/
public
PermissionGroup
(
String
id
,
@Nonnull
Class
owner
,
Localizable
title
)
throws
IllegalStateException
{
this
.
owner
=
owner
;
this
.
title
=
title
;
this
.
id
=
id
;
register
(
this
);
}
private
String
id
()
{
/**
* Gets ID of the permission group.
* @return Non-localizable ID of the permission group.
*/
public
String
getId
()
{
return
id
;
}
public
String
getOwnerClassName
()
{
return
owner
.
getName
();
}
...
...
@@ -110,7 +133,7 @@ public final class PermissionGroup implements Iterable<Permission>, Comparable<P
// among the permissions of the same group, just sort by their names
// so that the sort order is consistent regardless of classloading order.
return
id
().
compareTo
(
that
.
id
());
return
getOwnerClassName
().
compareTo
(
that
.
getOwnerClassName
());
}
private
int
compareOrder
()
{
...
...
@@ -119,11 +142,11 @@ public final class PermissionGroup implements Iterable<Permission>, Comparable<P
}
@Override
public
boolean
equals
(
Object
o
)
{
return
o
instanceof
PermissionGroup
&&
id
().
equals
(((
PermissionGroup
)
o
).
id
());
return
o
instanceof
PermissionGroup
&&
getOwnerClassName
().
equals
(((
PermissionGroup
)
o
).
getOwnerClassName
());
}
@Override
public
int
hashCode
()
{
return
id
().
hashCode
();
return
getOwnerClassName
().
hashCode
();
}
public
synchronized
int
size
()
{
...
...
@@ -131,12 +154,12 @@ public final class PermissionGroup implements Iterable<Permission>, Comparable<P
}
@Override
public
String
toString
()
{
return
"PermissionGroup["
+
id
()
+
"]"
;
return
"PermissionGroup["
+
getOwnerClassName
()
+
"]"
;
}
private
static
synchronized
void
register
(
PermissionGroup
g
)
{
if
(!
PERMISSIONS
.
add
(
g
))
{
throw
new
IllegalStateException
(
"attempt to register a second PermissionGroup for "
+
g
.
id
());
throw
new
IllegalStateException
(
"attempt to register a second PermissionGroup for "
+
g
.
getOwnerClassName
());
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录