Package org.apache.slide.structure

Examples of org.apache.slide.structure.SubjectNode


                    else if (level > 0) {
                        int nextLevel = level - 1;
                        boolean match = false;
                        Iterator i = memberNodes.iterator();
                        while (!match && i.hasNext()) {
                            SubjectNode nextMatchNode = (SubjectNode)i.next();
                            if (namespaceConfig.isRole(nextMatchNode.getUri())
                                || namespaceConfig.isGroup(nextMatchNode.getUri())) {
                               
                                match = matchPrincipal(token, checkSubject, nextMatchNode, nextLevel);
                            }
                        }
                        return match;
View Full Code Here


       
        try {
            if ( WebdavEvent.MKCOL.isEnabled() ) EventDispatcher.getInstance().fireVetoableEvent(WebdavEvent.MKCOL, new WebdavEvent(this));

            if (!isLockNull) {
                SubjectNode collection = new SubjectNode();
                structure.create(slideToken, collection, colName);
                content.create(slideToken, colName, revisionDescriptor, null);
            }
            else {
                content.store(slideToken, colName, revisionDescriptor, null);
View Full Code Here

        return hasRole(token, (SubjectNode)getPrincipal(token), role);
    }
   
    // overwrites super
    public boolean hasRole(SlideToken token, SubjectNode subjectNode, String role) throws ServiceAccessException, ObjectNotFoundException {
        SubjectNode roleNode = null;
        if (namespaceConfig.getRolesPath() != null && namespaceConfig.getRolesPath().length() != 0) {
            roleNode = SubjectNode.getSubjectNode(namespaceConfig.getRolesPath()+"/"+role);
        }
        if (roleNode != null && matchPrincipal(token, subjectNode, roleNode)) {
            return true;
        }
        else {
            // check groups
            SubjectNode groupNode = null;
            if (namespaceConfig.getGroupsPath() != null && namespaceConfig.getGroupsPath().length() != 0) {
                groupNode = SubjectNode.getSubjectNode(namespaceConfig.getGroupsPath()+"/"+role);
            }
            return (groupNode != null && matchPrincipal(token, subjectNode, groupNode));
        }
View Full Code Here

       
        // if org.apache.slide.principalIdentifiedLocks is true the lock-owner
        // must not provide the lock token (i.e. it must not be present in the
        // slide token)
        if (Configuration.usePrincipalIdentifiedLocks()) {
            SubjectNode principalNode = null;
            SubjectNode ownerNode = SubjectNode.getSubjectNode(token.getSubjectUri());
            try {
                principalNode = (SubjectNode)securityHelper.getPrincipal(slideToken);
            }
            catch (SlideException e) {}
           
            if (ownerNode != null &&
                !ownerNode.equals(SubjectNode.UNAUTHENTICATED) &&
                ownerNode.equals(principalNode))
            {
                return true;
            }
            return (slideToken.checkLockToken(token.getLockId()));
        } else {
View Full Code Here

    /**
     * Evaluates speified ACL by first-match principle
     */
    private boolean evaluateAcl(SlideToken token, ObjectNode objectNode, ActionNode actionNode, Enumeration permissions) throws ServiceAccessException, ObjectNotFoundException {
        boolean result = false;
        SubjectNode subjectNode = (SubjectNode)getPrincipal(token);
        while (permissions.hasMoreElements()) {
            NodePermission permission = (NodePermission)permissions.nextElement();
            if (match(token, objectNode, subjectNode, actionNode, permission)) {
                result = !permission.isNegative();
                break;
View Full Code Here

            NodeRevisionDescriptor nrd =
                objectUri.getStore().retrieveRevisionDescriptor(objectUri, new NodeRevisionNumber());
            NodeProperty ownerProp = nrd.getProperty("owner");
            if (ownerProp != null && ownerProp.getValue() != null) {
                String usersPath = namespace.getConfig().getUsersPath();
                SubjectNode ownerSubject = SubjectNode.getSubjectNode(usersPath+"/"+ownerProp.getValue());
                return ownerSubject.equals(checkSubject);
            }
            else {
                return false;
            }
        }
View Full Code Here

     * @throws   ObjectNotFoundException
     * @throws   ServiceAccessException
     */
    public boolean checkLockOwner(SlideToken slideToken, NodeLock token) throws ObjectNotFoundException, ServiceAccessException {
        boolean canUnlock = true;
        SubjectNode principal = (SubjectNode)securityHelper.getPrincipal(slideToken);
        SubjectNode lockOwner = SubjectNode.getSubjectNode(token.getSubjectUri());
        if (!securityHelper.matchPrincipal(slideToken, principal, lockOwner)) {
            // it is not the lock owner ... now check the kill-lock privilege
            try {
                securityHelper.checkCredentials(slideToken,
                                                SubjectNode.getSubjectNode(token.getObjectUri()),
View Full Code Here

       
        // lock-types-are-equal
        boolean condition1 = matchToken.getTypeUri().equals(checkToken.getTypeUri());
       
        // user-of-tokens-are-equal OR user-of-matchToken-is-parent
        SubjectNode checkSubject = SubjectNode.getSubjectNode(checkToken.getSubjectUri());
        SubjectNode matchSubject = SubjectNode.getSubjectNode(matchToken.getSubjectUri());
        boolean condition2 =
            securityHelper.matchPrincipal(slideToken, checkSubject, matchSubject);
       
        // lock-types-are-equal OR lock-type-of-matchToken-is-parent
        ActionNode checkAction = ActionNode.getActionNode(checkToken.getTypeUri());
View Full Code Here

        NodeRevisionDescriptors nrds = content.retrieve(slideToken, resourcePath);
        NodeRevisionDescriptor nrd = content.retrieve(slideToken, nrds);
        Enumeration permissions = security.enumeratePermissions(slideToken, resourcePath, true);
        while (permissions != null && permissions.hasMoreElements()) {
            NodePermission p = (NodePermission)permissions.nextElement();
            SubjectNode principalNode = SubjectNode.getSubjectNode(p.getSubjectUri());
            String principalPath = getPrincipalPath(principalNode, nrd);
            if (principalPath != null) {
                multistatusElm.addContent(getResponseElement(slideToken, principalPath, new NodeRevisionNumber(), requestedProperties));
            }
        }
View Full Code Here

     *
     * @throws   SlideException
     * @throws   IOException
     */
    public void execute(String resourcePath, Element multistatusElm, int depth) throws SlideException, IOException {
        SubjectNode currentUserNode = (SubjectNode)security.getPrincipal(slideToken);
        Element queryElm = getQueryElement(resourcePath, currentUserNode);
        new XMLOutputter(org.jdom.output.Format.getPrettyFormat()).output(queryElm, System.out);
       
        String absUri = WebdavUtils.getAbsolutePath (resourcePath, slideContextPath, config);
       
View Full Code Here

TOP

Related Classes of org.apache.slide.structure.SubjectNode

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.