Package org.apache.jetspeed.om.security

Examples of org.apache.jetspeed.om.security.Permission


     * @throws Exception
     */
    public void testRevokePermission() throws Exception
    {
        PermissionManagement service = getService();
        Permission permission = null;
        JetspeedSecurityCache.loadRolePermissions();

        try
        {
            service.revokePermission("user", "close");
View Full Code Here


     * @throws Exception
     */
    public void testHasPermission() throws Exception
    {
        PermissionManagement service = getService();
        Permission permission = null;
        JetspeedSecurityCache.loadRolePermissions();

        try
        {
            boolean has = service.hasPermission("user", "view");
View Full Code Here

                Role role = (Role)roles.next();
                Map map = new HashMap();
                Iterator prms = JetspeedSecurity.getPermissions(role.getName());
                while (prms.hasNext())
                {
                    Permission perm = (Permission)prms.next();
                    map.put(perm.getName(), perm);
                }
                perms.put(role.getName(), map);
            }
        }
        catch (JetspeedSecurityException e)
View Full Code Here

            assertTrue(!service.hasRole(user.getUserName(), "user"));
            Role role3 = service.getRole(user.getUserName(),"user");
            assertTrue(null == role3);

            // add permission
            Permission perm1 = JetspeedSecurity.getPermission("info");
            assertTrue(null != perm1);
            service.addPermission("guest", perm1);
            Permission permission = service.getPermission("guest", "info");
            assertTrue(permission.getName().equals("info"));
            assertTrue(service.hasPermission("guest", "info"));

            // remove permission
            service.removePermission("guest", "info");
            assertTrue(!service.hasPermission( "guest", "info"));
            Permission perm2 = service.getPermission( "guest", "info");
            assertTrue(null == perm2);

        }
        catch (Exception e)
        {
View Full Code Here

                perms = new HashMap();

            for (int ix = 0; ix < rels.size(); ix++)
            {
                TurbineRolePermission rel = (TurbineRolePermission)rels.get(ix);
                Permission perm = rel.getTurbinePermission();
                perms.put(perm.getName(), perm);
            }
        }
        catch(Exception e)
        {
            throw new PermissionException("Failed to retrieve permissions ", e);
View Full Code Here

    {
        Connection conn = null;
        try
        {
            conn = Torque.getConnection();
            Permission permission = this.getPermission(permissionName);

            Criteria criteria = new Criteria();
            criteria.add(TurbinePermissionPeer.PERMISSION_NAME, permissionName);

            if(cascadeDelete)
            {
                // CASCADE to TURBINE_ROLE_PERMISSION
                Criteria critRolePerm = new Criteria();
                critRolePerm.add(TurbineRolePermissionPeer.PERMISSION_ID, permission.getId());
                TurbineRolePermissionPeer.doDelete(critRolePerm, conn);
            }
            TurbinePermissionPeer.doDelete(criteria, conn);
               
            conn.commit();
View Full Code Here

        throws JetspeedSecurityException
    {
        try
        {
            Role role = JetspeedSecurity.getRole(roleName);
            Permission permission = this.getPermission(permissionName);

            Criteria criteria = new Criteria();
            criteria.add(TurbineRolePermissionPeer.ROLE_ID, role.getId());
            criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, permission.getId());
            TurbineRolePermissionPeer.doInsert(criteria);
            if (cachingEnable)
            {
                JetspeedSecurityCache.addPermission(roleName,permission);
            }
View Full Code Here

        throws JetspeedSecurityException
    {
        try
        {
            Role role = JetspeedSecurity.getRole(roleName);
            Permission permission = this.getPermission(permissionName);

            Criteria criteria = new Criteria();
            criteria.add(TurbineRolePermissionPeer.ROLE_ID, role.getId());
            criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, permission.getId());
            TurbineRolePermissionPeer.doDelete(criteria);
            if (cachingEnable)
            {
                JetspeedSecurityCache.removePermission(roleName, permissionName);
            }
View Full Code Here

            {
                return JetspeedSecurityCache.hasPermission(roleName, permissionName);
            }

            Role role = JetspeedSecurity.getRole(roleName);
            Permission permission = this.getPermission(permissionName);

            Criteria criteria = new Criteria();
            criteria.add(TurbineRolePermissionPeer.ROLE_ID, role.getId());
            criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, permission.getId());
            permissions = TurbineRolePermissionPeer.doSelect(criteria);

        }
        catch(Exception e)
        {
View Full Code Here

        boolean sel = false;
        int ix = 0;
        selected.add(0, new Boolean(sel));
        while(master.hasNext())
        {
            Permission permission = (Permission) master.next();
            permissions.add(permission);
            sel = JetspeedSecurity.hasPermission(roleName, permission.getName());
            ix = ix + 1;
            selected.add(ix, new Boolean(sel));
        }
        selected.trimToSize();
        permissions.trimToSize();
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.security.Permission

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.