From f63722a2fe171f859aaf117393f30fd9ee9bc2c3 Mon Sep 17 00:00:00 2001 From: j2blake Date: Fri, 23 Dec 2011 16:49:19 +0000 Subject: [PATCH] NIHVIVO-3523 The IsRootUser identifier takes no parameters, so make it a singleton. --- .../vitro/webapp/auth/identifier/common/IsRootUser.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/IsRootUser.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/IsRootUser.java index a41c2ab04..01c47322e 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/IsRootUser.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/IsRootUser.java @@ -9,10 +9,17 @@ import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; * The current user is a root user. */ public class IsRootUser extends AbstractCommonIdentifier implements Identifier { + public static final IsRootUser INSTANCE = new IsRootUser(); + public static boolean isRootUser(IdentifierBundle ids) { return !getIdentifiersForClass(ids, IsRootUser.class).isEmpty(); } - + + /** Enforce the singleton pattern. */ + private IsRootUser() { + // Nothing to initialize. + } + @Override public String toString() { return "IsRootUser";