Package org.apache.jetspeed.om.registry

Examples of org.apache.jetspeed.om.registry.SecurityAccess


     */
    public boolean revokeRoleAccess(String action, String role)
    {
        if (allowsSpecificRole(action, role))
        {
            SecurityAccess access = getAccess(action);
            List allows = access.getAllows();
            if (allows == null || allows.isEmpty())
            {
                revokeAccess(action);
                return false;
            }

            for (int i = 0; i < allows.size(); i++)
            {
                BaseSecurityAllow allow = (BaseSecurityAllow) allows.get(i);
                if (allow.getRole() != null && allow.getRole().equals(role))
                {
                    allows.remove(i);
                    if (allows.isEmpty() && access.getOwnerAllows().isEmpty())
                    {
                        revokeAccess(action);
                    }

                    return true;
View Full Code Here


    */
    public boolean revokeUserAccess(String action, String user)
    {
        if (allowsSpecificUser(action, user))
        {
            SecurityAccess access = getAccess(action);
            List allows = access.getAllows();
            if (allows == null || allows.isEmpty())
            {
                revokeAccess(action);
                return false;
            }

            for (int i = 0; i < allows.size(); i++)
            {
                BaseSecurityAllow allow = (BaseSecurityAllow) allows.get(i);
                if (allow.getUser() != null && allow.getUser().equals(user))
                {
                    allows.remove(i);
                    if (allows.isEmpty() && access.getOwnerAllows().isEmpty())
                    {
                        revokeAccess(action);
                    }

                    return true;
View Full Code Here

   

    private void buildAccessMap()
    {
        Map actionMap = null;
        SecurityAccess accessElement = null;

        synchronized (accessMapSync)
        {
            if (accessMap == null)
            {
                accessMap = new HashMap();
            }

            accessMap.clear();
        }
        // Build allow map
        for (Iterator accessIterator = getAccesses().iterator(); accessIterator.hasNext();)
        {
            accessElement = (SecurityAccess) accessIterator.next();

            // Get action map of the action.  Create one if none exists
            String action = accessElement.getAction();

            if (action == null)
            {
                action = ALL_ACTIONS;
            }
View Full Code Here

            assertTrue("Getting expect security entry", securityEntry.getName().equals("basic_testcase"));

            // Get the action
            Vector securityAccesses = securityEntry.getAccesses();
            assertNotNull("Got SecurityAccesses", securityAccesses);
            SecurityAccess securityAccess = (SecurityAccess) securityAccesses.firstElement();
            assertNotNull("Got SecurityAccess", securityAccess);
            assertEquals("Verify action", "view", securityAccess.getAction());

            // Get allows
            Vector securityAllows = securityAccess.getAllows();
            assertNotNull("Got SecurityAllows", securityAllows);
            SecurityAllow securityAllow = (SecurityAllow) securityAllows.firstElement();
            assertNotNull("Got SecurityAllow", securityAllow);
            assertEquals("Verify role", "clerk", securityAllow.getRole());
            assertNull("Verify user" , securityAllow.getUser());
View Full Code Here

     * Checks whether a role is specifically allowed to access the request action
     * This method ignores the "*" action and is here to play a maintenance role.
     */
    public boolean allowsSpecificRole( String action, String role)
    {
        SecurityAccess access = (SecurityAccess) getAccess(action);
        if (access.getAllAllows() != null)
        {
            Iterator allAllows = access.getAllows().iterator();
            while (allAllows.hasNext())
            {
                SecurityAllow allow = (SecurityAllow) allAllows.next();
                if (allow.getRole() != null && allow.getRole().equals(role))
                {
View Full Code Here

     */
    public boolean grantRoleAccess(String action, String role)
    {
        if (!allowsSpecificRole(action, role))
        {
            SecurityAccess access = getAccess(action);
            List allows = access.getAllows();
            if (allows == null)
            {
                allows = new Vector();
            }

View Full Code Here

     */
    public boolean grantUserAccess(String action, String user)
    {
        if (!allowsSpecificUser(action, user))
        {
            SecurityAccess access = getAccess(action);
            List allows = access.getAllows();
            if (allows == null)
            {
                allows = new Vector();
            }

View Full Code Here

     */
    public boolean revokeRoleAccess(String action, String role)
    {
        if (allowsSpecificRole(action, role))
        {
            SecurityAccess access = getAccess(action);
            List allows = access.getAllows();
            if (allows == null || allows.isEmpty())
            {
                revokeAccess(action);
                return false;
            }

            for (int i = 0; i < allows.size(); i++)
            {
                BaseSecurityAllow allow = (BaseSecurityAllow) allows.get(i);
                if (allow.getRole() != null && allow.getRole().equals(role))
                {
                    allows.remove(i);
                    if (allows.isEmpty() && access.getOwnerAllows().isEmpty())
                    {
                        revokeAccess(action);
                    }

                    return true;
View Full Code Here

    */
    public boolean revokeUserAccess(String action, String user)
    {
        if (allowsSpecificUser(action, user))
        {
            SecurityAccess access = getAccess(action);
            List allows = access.getAllows();
            if (allows == null || allows.isEmpty())
            {
                revokeAccess(action);
                return false;
            }

            for (int i = 0; i < allows.size(); i++)
            {
                BaseSecurityAllow allow = (BaseSecurityAllow) allows.get(i);
                if (allow.getUser() != null && allow.getUser().equals(user))
                {
                    allows.remove(i);
                    if (allows.isEmpty() && access.getOwnerAllows().isEmpty())
                    {
                        revokeAccess(action);
                    }

                    return true;
View Full Code Here

   

    private void buildAccessMap()
    {
        Map actionMap = null;
        SecurityAccess accessElement = null;

        synchronized (accessMapSync)
        {
            if (accessMap == null)
            {
                accessMap = new HashMap();
            }

            accessMap.clear();
        }
        // Build allow map
        for (Iterator accessIterator = getAccesses().iterator(); accessIterator.hasNext();)
        {
            accessElement = (SecurityAccess) accessIterator.next();

            // Get action map of the action.  Create one if none exists
            String action = accessElement.getAction();

            if (action == null)
            {
                action = ALL_ACTIONS;
            }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.registry.SecurityAccess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.