use of org.jaffa.security.securityrolesdomain.Roles in project jaffa-framework by jaffa-projects.
the class RoleManager method getRoles.
/**
* getRoles - Returns the Roles object which contains a list of Role objects.
* @return the Roles object which will contain a List of Role
*/
public Roles getRoles() {
Roles roles = new Roles();
roles.getRole().addAll(getAllRoles());
return roles;
}
use of org.jaffa.security.securityrolesdomain.Roles in project jaffa-framework by jaffa-projects.
the class RoleManager method unregisterResource.
/**
* unregisterResource - Unregisters the roles from the role repository using the roles.xml files found in META-INF/roles.xml
* that exist in the classpath. This is used to return the repository to its original state before a custom
* configuration was added.
* @param resource the object that contains the xml config file.
* @param context key with which config file to be registered.
* @throws JAXBException
* @throws SAXException
* @throws IOException
*/
@Override
public void unregisterResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
Roles roles = JAXBHelper.unmarshalConfigFile(Roles.class, resource, CONFIGURATION_SCHEMA_FILE);
if (roles.getRole() != null) {
for (final Role role : roles.getRole()) {
ContextKey key = new ContextKey(role.getName(), resource.getURI().toString(), variation, context);
unregisterRole(key);
}
}
}
use of org.jaffa.security.securityrolesdomain.Roles in project jaffa-framework by jaffa-projects.
the class CheckPolicyComponent method getRoleMap.
/**
* This creates a HashMap of role and list bussiness-functions for that role
*/
static HashMap getRoleMap() {
// Get the roles, throws exceptions if there are issues
Roles roles = PolicyCache.getRoles();
m_roleBFMap.clear();
List roleList = roles.getRole();
// Bail if there are no roles....
if (roleList == null) {
return m_roleBFMap;
}
// Loop of all the role objects
for (Iterator it = roleList.iterator(); it.hasNext(); ) {
Role role = (Role) it.next();
if (log.isDebugEnabled()) {
log.debug("Processing Role: " + role.getName());
}
List access = role.getGrantFunctionAccess();
List funcs = null;
if (access != null) {
funcs = new ArrayList();
// Add all the names in all of the GrantAccess objects to the list.
for (Iterator it2 = access.iterator(); it2.hasNext(); ) {
GrantFunctionAccess gfa = (GrantFunctionAccess) it2.next();
funcs.add(gfa.getName());
if (log.isDebugEnabled()) {
log.debug("Processing Role: " + role.getName() + " has function " + gfa.getName());
}
}
}
// If there are some functions, add it to the master hashmap
if (funcs != null) {
m_roleBFMap.put(role.getName(), funcs);
}
}
// Return the construsted Map
return m_roleBFMap;
}
Aggregations