From 16fb103a93b8d1ff706fba611f4eabdd1de7acd4 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sun, 23 Dec 2007 22:38:39 +0000 Subject: [PATCH] adding more accessor methods. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6399 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/security/Permission.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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(); + } } //