Search in sources :

Example 6 with Roles

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;
}
Also used : Roles(org.jaffa.security.securityrolesdomain.Roles)

Example 7 with 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);
        }
    }
}
Also used : Role(org.jaffa.security.securityrolesdomain.Role) ContextKey(org.jaffa.loader.ContextKey) Roles(org.jaffa.security.securityrolesdomain.Roles)

Example 8 with Roles

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;
}
Also used : Role(org.jaffa.security.securityrolesdomain.Role) GrantFunctionAccess(org.jaffa.security.securityrolesdomain.GrantFunctionAccess) Roles(org.jaffa.security.securityrolesdomain.Roles)

Aggregations

Roles (org.jaffa.security.securityrolesdomain.Roles)8 Role (org.jaffa.security.securityrolesdomain.Role)7 ActionMessage (org.apache.struts.action.ActionMessage)2 ContextKey (org.jaffa.loader.ContextKey)2 Exclude (org.jaffa.security.securityrolesdomain.Exclude)2 Include (org.jaffa.security.securityrolesdomain.Include)2 UserMaintenanceException (org.jaffa.applications.jaffa.modules.admin.components.usermaintenance.tx.exceptions.UserMaintenanceException)1 UserRole (org.jaffa.applications.jaffa.modules.admin.domain.UserRole)1 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)1 GrantFunctionAccess (org.jaffa.security.securityrolesdomain.GrantFunctionAccess)1