Package org.apache.jetspeed.security

Examples of org.apache.jetspeed.security.PortletPermission

@author David Le Strat

        ums.addUser("mappedroleuser", "password");
        rms.addRole("mappedrole");
        rms.addRole("mappedrole.role1");
        gms.addGroup("mappedgroup");
       
        Permission perm = new PortletPermission("myportlet", "view");
        pms.addPermission(perm);
        pms.grantPermission(new RolePrincipalImpl("mappedrole"), perm);
       
        rms.addRoleToUser("mappedroleuser", "mappedrole");
        rms.addRoleToGroup("mappedrole", "mappedgroup");   
View Full Code Here


            rms.removeRole("mappedrole.role1");
        if (rms.roleExists("mappedrole.role1"))
            rms.removeRole("mappedrole");
        if (gms.groupExists("mappedgroup"))
            gms.removeGroup("mappedgroup");
        PortletPermission pp = new PortletPermission("myportlet", "view");
        if (pms.permissionExists(pp))
            pms.removePermission(pp);  
    }
View Full Code Here

        }
        else
        {
            try
            {
                AccessController.checkPermission(new PortletPermission(portlet.getUniqueName(), mask));
            }
            catch (AccessControlException ace)
            {
                return false;
            }
View Full Code Here

            {
                String roleName = (String)roles.next();
                Role userRole = roleManager.getRole(roleName);
                if (userRole != null)
                {
                    Permission permission = new PortletPermission(paName + "::*", "view, edit");
                    if (!permissionManager.permissionExists(permission))
                    {
                        permissionManager.addPermission(permission);
                        permissionManager.grantPermission(userRole.getPrincipal(), permission);
                    }                   
View Full Code Here

            {
                String roleName = (String)roles.next();
                Role userRole = roleManager.getRole(roleName);
                if (userRole != null)
                {
                    Permission permission = new PortletPermission(paName + "::*", "view, edit");
                    if (permissionManager.permissionExists(permission))
                    {
                        permissionManager.removePermission(permission);
                    }                   
                   
View Full Code Here

        // The user should still exist.
        assertTrue(ums.userExists("mappedroleuser"));
        // The group should still exist.
        assertTrue(gms.groupExists("mappedgroup"));
        // The permission should still exist.
        assertTrue(pms.permissionExists(new PortletPermission("myportlet", "view")));
        // The user-role mapping should be gone.
        assertFalse(rms.isUserInRole("mappedroleuser", "mappedrole"));
        // The group-role mapping should be gone.
        assertFalse(rms.isGroupInRole("mappedgroup", "mappedroleuser"));
        // The permission-role mapping should be gone.
        Permissions perms = pms.getPermissions(new RolePrincipalImpl("mappedrole"));
        assertFalse(perms.implies(new PortletPermission("myportlet", "view")));
       
        destroyMappedRole();
    }
View Full Code Here

        ums.addUser("mappedroleuser", "password");
        rms.addRole("mappedrole");
        rms.addRole("mappedrole.role1");
        gms.addGroup("mappedgroup");
       
        Permission perm = new PortletPermission("myportlet", "view");
        pms.addPermission(perm);
        pms.grantPermission(new RolePrincipalImpl("mappedrole"), perm);
       
        rms.addRoleToUser("mappedroleuser", "mappedrole");
        rms.addRoleToGroup("mappedrole", "mappedgroup");   
View Full Code Here

            rms.removeRole("mappedrole.role1");
        if (rms.roleExists("mappedrole.role1"))
            rms.removeRole("mappedrole");
        if (gms.groupExists("mappedgroup"))
            gms.removeGroup("mappedgroup");
        PortletPermission pp = new PortletPermission("myportlet", "view");
        if (pms.permissionExists(pp))
            pms.removePermission(pp);  
    }
View Full Code Here

        }
        else
        {
            try
            {
                AccessController.checkPermission(new PortletPermission(portlet.getUniqueName(), mask));
            }
            catch (AccessControlException ace)
            {
                return false;
            }
View Full Code Here

    {
        try
        {
            // TODO: it may be better to check the PagePermission for the outer most
            // fragment (i.e. the PSML page)
            AccessController.checkPermission(new PortletPermission(resource, action));           
        }
        catch (AccessControlException e)
        {
            return false;
        }       
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.PortletPermission

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.