public class BaseHandler
extends java.lang.Object
implements redstone.xmlrpc.XmlRpcInvocationHandler
Modifier and Type | Field and Description |
---|---|
static int |
VALID |
Constructor and Description |
---|
BaseHandler() |
Modifier and Type | Method and Description |
---|---|
static void |
ensureConfigAdmin(User user)
Private helper method to make sure a user has config admin role.
|
static void |
ensureOrgAdmin(User user)
Private helper method to make sure a user has org admin role.
|
static void |
ensureOrgOrConfigAdmin(User user)
Public helper method to make sure a user has either
an org admin or a config admin role
If not, this will throw a generic Permission exception.
|
static void |
ensureSatAdmin(User user)
Private helper method to make sure a user has sat admin role.
|
static void |
ensureSystemGroupAdmin(User user)
Private helper method to make sure a user has system group admin role.
|
static void |
ensureUserRole(User user,
Role role)
Private helper method to make sure a user the given role..
|
static User |
getLoggedInUser(java.lang.String sessionKey)
Gets the currently logged in user.
|
java.lang.Object |
invoke(java.lang.String methodCalled,
java.util.List params)
called by BaseHandler.doPost, contains the code that determines what
method to call of a subclassed-object
|
protected boolean |
providesAuthentication() |
protected void |
setEntityAttribute(java.lang.String attrName,
java.lang.Object entity,
java.lang.Object value)
Take an attributeName and value, and apply them to an Object.
|
protected Server |
validateClientCertificate(java.lang.String clientCert) |
protected void |
validateEntitlements(java.util.List<Entitlement> entitlements)
Validate that specified entitlement names correspond to real entitlements
that can be changed via API (in other words, they are not permanent).
|
protected void |
validateMap(java.util.Set<java.lang.String> validKeys,
java.util.Map map)
Validate that the keys provided in the map provided
by the user are valid.
|
protected Org |
verifyOrgExists(java.lang.Number orgId)
Ensure the org exists
|
public static final int VALID
protected boolean providesAuthentication()
public java.lang.Object invoke(java.lang.String methodCalled, java.util.List params) throws redstone.xmlrpc.XmlRpcFault
invoke
in interface redstone.xmlrpc.XmlRpcInvocationHandler
methodCalled
- the xmlrpc function called, like
'registration.privacy_statement'params
- a Vector of the parameters to methodCalledredstone.xmlrpc.XmlRpcFault
- if some error occurspublic static User getLoggedInUser(java.lang.String sessionKey)
sessionKey
- The key containing the session id that we can use to load the
session.public static void ensureOrgAdmin(User user) throws PermissionCheckFailureException
user
- The user to checkPermissionCheckFailureException
- if user is not an org adminpublic static void ensureSatAdmin(User user) throws PermissionCheckFailureException
user
- The user to checkPermissionCheckFailureException
- if user is not an sat adminpublic static void ensureSystemGroupAdmin(User user) throws PermissionCheckFailureException
user
- The user to checkPermissionCheckFailureException
- if user is not a system group adminpublic static void ensureConfigAdmin(User user) throws PermissionCheckFailureException
user
- The user to checkPermissionCheckFailureException
- if user is not a config admin.public static void ensureOrgOrConfigAdmin(User user) throws PermissionCheckFailureException
user
- The user to checkPermissionCheckFailureException
- if user is neither org nor config admin.public static void ensureUserRole(User user, Role role) throws PermissionCheckFailureException
user
- The user to checkrole
- the role to checkPermissionCheckFailureException
- if user does not
have the given roleprotected Org verifyOrgExists(java.lang.Number orgId)
orgId
- the org id to checkprotected void validateEntitlements(java.util.List<Entitlement> entitlements)
entitlements
- List of string entitlement labels to be validated.protected void validateMap(java.util.Set<java.lang.String> validKeys, java.util.Map map)
validKeys
- Set of keys that are valid for this requestmap
- The map to validateprotected void setEntityAttribute(java.lang.String attrName, java.lang.Object entity, java.lang.Object value)
attrName
- Attribute to set - assumes entity.set<Attrname>(value)
existsentity
- The Object we are updatingvalue
- The new value to pass to set<AttrName>protected Server validateClientCertificate(java.lang.String clientCert)