diff --git a/core/src/main/java/hudson/security/Permission.java b/core/src/main/java/hudson/security/Permission.java index e3b6ce15ae..f3173406db 100644 --- a/core/src/main/java/hudson/security/Permission.java +++ b/core/src/main/java/hudson/security/Permission.java @@ -127,6 +127,15 @@ public final class Permission { return ALL_GROUPS; } + /** + * Gets the {@link Group} whose {@link Group#owner} is the given class. + * + * @return null if not found. + */ + public static Group getGroup(Class owner) { + return PERMISSIONS.get(owner); + } + /** * All the permissions in the system, keyed by their owners. */ @@ -195,6 +204,10 @@ public final class Permission { public int compareTo(Group that) { return this.owner.getName().compareTo(that.owner.getName()); } + + public int size() { + return permisisons.size(); + } } //