Class PermissionRegistry
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.auth.permissions.PermissionRegistry
-
public class PermissionRegistry extends Object
A collection of Permission objects, keyed by URI. Resides in the ServletContext. This is not thread-safe, so Permissions should be added only during context initialization.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPermissionRegistry.Setup
-
Constructor Summary
Constructors Constructor Description PermissionRegistry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPermission(Permission p)This class is not thread-safe, so permissions should be added only during context initialization.voidaddPermissions(Collection<? extends Permission> permissions)This class is not thread-safe, so permissions should be added only during context initialization.static voidcreateRegistry(javax.servlet.ServletContext ctx, Collection<? extends Permission> permissions)Create the registry and store it in the context.PermissiongetPermission(String uri)Get the permission that is registered with this URI.static PermissionRegistrygetRegistry(javax.servlet.ServletContext ctx)Get the registry from the context.booleanisPermission(String uri)Is there a Permission registered with this URI?static booleanisRegistryCreated(javax.servlet.ServletContext ctx)Has the registry been created yet?
-
-
-
Method Detail
-
isRegistryCreated
public static boolean isRegistryCreated(javax.servlet.ServletContext ctx)
Has the registry been created yet?
-
createRegistry
public static void createRegistry(javax.servlet.ServletContext ctx, Collection<? extends Permission> permissions)Create the registry and store it in the context.
-
getRegistry
public static PermissionRegistry getRegistry(javax.servlet.ServletContext ctx)
Get the registry from the context. If there isn't one, throw an exception.
-
addPermissions
public void addPermissions(Collection<? extends Permission> permissions)
This class is not thread-safe, so permissions should be added only during context initialization.
-
addPermission
public void addPermission(Permission p)
This class is not thread-safe, so permissions should be added only during context initialization.
-
isPermission
public boolean isPermission(String uri)
Is there a Permission registered with this URI?
-
getPermission
public Permission getPermission(String uri)
Get the permission that is registered with this URI. If there is no such Permission, return a BrokenPermission that always denies authorization. If you want to know whether an actual Permission has been registered at this URI, call isPermission() instead.
-
-