Examples of InternalPrincipal


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

            Iterator principals = permission.getPrincipals().iterator();
            int count = 0;
            StringBuffer result = new StringBuffer();
            while (principals.hasNext())
            {
                InternalPrincipal principal = (InternalPrincipal)principals.next();
                int last = principal.getFullPath().lastIndexOf("/") + 1;
                result.append(principal.getFullPath().substring(last));           
                count++;
                if (count < size)
                {
                    result.append(",");
                }
View Full Code Here

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

                Iterator list2 = p.getPrincipals().iterator();
                while (list2.hasNext())
                {
                    o = list2.next();
                    InternalPrincipal principal = (InternalPrincipal) o;
                    String path = principal.getFullPath();
                    if (path.startsWith("/role/"))
                    {
                        JSRole _tempRole = (JSRole) this.getObjectBehindPath(
                                roleMap, removeFromString(path, "/role/"));
                        if (_tempRole != null)
View Full Code Here

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

                Iterator list2 = p.getPrincipals().iterator();
                while (list2.hasNext())
                {
                    o = list2.next();
                    InternalPrincipal principal = (InternalPrincipal) o;
                    String path = principal.getFullPath();
                    if (path.startsWith("/role/"))
                    {
                        JSRole _tempRole = (JSRole) this.getObjectBehindPath(
                                roleMap, removeFromString(path, "/role/"));
                        if (_tempRole != null)
View Full Code Here

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

            Iterator principals = permission.getPrincipals().iterator();
            int count = 0;
            StringBuffer result = new StringBuffer();
            while (principals.hasNext())
            {
                InternalPrincipal principal = (InternalPrincipal)principals.next();
                int last = principal.getFullPath().lastIndexOf("/") + 1;
                result.append(principal.getFullPath().substring(last));           
                count++;
                if (count < size)
                {
                    result.append(",");
                }
View Full Code Here

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

                Iterator list2 = p.getPrincipals().iterator();
                while (list2.hasNext())
                {
                    o = list2.next();
                    InternalPrincipal principal = (InternalPrincipal) o;
                    String path = principal.getFullPath();
                    if (path.startsWith("/role/"))
                    {
                        JSRole _tempRole = (JSRole) this.getObjectBehindPath(
                                roleMap, removeFromString(path, "/role/"));
                        if (_tempRole != null)
View Full Code Here

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

            permissionsCache.set(permissionsMap);
        }
        HashSet principalPermissions = (HashSet)permissionsMap.get(fullPath);
        if ( principalPermissions == null )
        {
            InternalPrincipal internalPrincipal = getInternalPrincipal(fullPath);
            if (null != internalPrincipal)
            {
                principalPermissions = getSecurityPermissions(internalPrincipal.getPermissions());
            }
            if ( principalPermissions == null)
            {
                principalPermissions = new HashSet();
            }
View Full Code Here

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

                Query query = QueryFactory.newQuery(InternalPrincipalImpl.class, filter);
                Collection internalPrincipals = getPersistenceBrokerTemplate().getCollectionByQuery(query);
                Iterator internalPrincipalsIter = internalPrincipals.iterator();
                while (internalPrincipalsIter.hasNext())
                {
                    InternalPrincipal internalPrincipal = (InternalPrincipal) internalPrincipalsIter.next();
                    Collection internalPermissions = internalPrincipal.getPermissions();
                    if (null != internalPermissions)
                    {
                        principalPermissions = getSecurityPermissions(internalPermissions);
                        permissionsSet.addAll(principalPermissions);
                    }
                    else
                    {
                        principalPermissions = new HashSet();
                    }
                    permissionsMap.put(internalPrincipal.getFullPath(),principalPermissions);
                }
            }
            iter = permissionsSet.iterator();
            while (iter.hasNext())
            {
View Full Code Here

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

        String fullPath = SecurityHelper.getPreferencesFullPath(principal);
        ArgUtil.notNull(new Object[] { fullPath }, new String[] { "fullPath" },
                "removePermission(java.security.Principal)");

        // Remove permissions on principal.
        InternalPrincipal internalPrincipal = getInternalPrincipal(fullPath);
        if (null != internalPrincipal)
        {
            Collection internalPermissions = internalPrincipal.getPermissions();
            if (null != internalPermissions)
            {
                internalPermissions.clear();
            }
            // clear the whole ThreadLocal permissions cache
            permissionsCache.set(null);
            try
            {
                internalPrincipal.setModifiedDate(new Timestamp(System.currentTimeMillis()));
                internalPrincipal.setPermissions(internalPermissions);
               
                getPersistenceBrokerTemplate().store(internalPrincipal);
            }
            catch (Exception e)
            {
View Full Code Here

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

        ArgUtil.notNull(new Object[] { fullPath, permission }, new String[] { "fullPath", "permission" },
                "grantPermission(java.security.Principal, java.security.Permission)");

        Collection internalPermissions = new ArrayList();

        InternalPrincipal internalPrincipal = getInternalPrincipal(fullPath);
        if (null == internalPrincipal)
        {
            if ( principal instanceof UserPrincipal )
            {
                throw new SecurityException(SecurityException.USER_DOES_NOT_EXIST.create(principal.getName()));
            }
            else if ( principal instanceof RolePrincipal )
            {
                throw new SecurityException(SecurityException.ROLE_DOES_NOT_EXIST.create(principal.getName()));
            }
            // must/should be GroupPrincipal
            throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(principal.getName()));
        }
        InternalPermission internalPermission = getInternalPermission(permission);
        if (null == internalPermission)
        {
            throw new SecurityException(SecurityException.PERMISSION_DOES_NOT_EXIST.create(permission.getName()));
        }

        if (null != internalPrincipal.getPermissions())
        {
            internalPermissions.addAll(internalPrincipal.getPermissions());
        }
        if (!internalPermissions.contains(internalPermission))
        {
            internalPermissions.add(internalPermission);
        }
        // clear the whole ThreadLocal permissions cache
        permissionsCache.set(null);
        try
        {
            internalPrincipal.setModifiedDate(new Timestamp(System.currentTimeMillis()));
            internalPrincipal.setPermissions(internalPermissions);
           
            getPersistenceBrokerTemplate().store(internalPrincipal);
        }
        catch (Exception e)
        {
View Full Code Here

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

        String fullPath = SecurityHelper.getPreferencesFullPath(principal);
        ArgUtil.notNull(new Object[] { fullPath, permission }, new String[] { "fullPath", "permission" },
                "revokePermission(java.security.Principal, java.security.Permission)");

        // Remove permissions on principal.
        InternalPrincipal internalPrincipal = getInternalPrincipal(fullPath);
        if (null != internalPrincipal)
        {
            Collection internalPermissions = internalPrincipal.getPermissions();
            if (null != internalPermissions)
            {
                boolean revokePermission = false;
                ArrayList newInternalPermissions = new ArrayList();
                Iterator internalPermissionsIter = internalPermissions.iterator();
                while (internalPermissionsIter.hasNext())
                {
                    InternalPermission internalPermission = (InternalPermission) internalPermissionsIter.next();
                    if (!((internalPermission.getClassname().equals(permission.getClass().getName()))
                            && (internalPermission.getName().equals(permission.getName())) && (internalPermission.getActions()
                            .equals(permission.getActions()))))
                    {
                        newInternalPermissions.add(internalPermission);
                    }
                    else
                    {
                        revokePermission = true;
                    }
                }
                if (revokePermission)
                {
                    // clear the whole ThreadLocal permissions cache
                    permissionsCache.set(null);
                    try
                    {
                        internalPrincipal.setModifiedDate(new Timestamp(System.currentTimeMillis()));
                        internalPrincipal.setPermissions(newInternalPermissions);

                        getPersistenceBrokerTemplate().store(internalPrincipal);
                    }
                    catch (Exception e)
                    {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.