Examples of XmlValue


Examples of org.apache.slide.util.XMLValue

        rootSp.addContent(p);
        Iterator roots = rootSet.iterator();
        while (roots.hasNext()) {
            rootSp.addContent((Element)work.get(roots.next()));
        }
        return new XMLValue(rootSp);
    }
View Full Code Here

Examples of org.apache.slide.util.XMLValue

     * @throws   AccessDeniedException
     * @throws   ObjectNotFoundException
     * @throws   JDOMException
     */
    public XMLValue computeCurrentuserPrivilegeSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
        XMLValue xmlValue = new XMLValue();
       
        NamespaceConfig config = nsaToken.getNamespaceConfig();
        Structure structure = nsaToken.getStructureHelper();
        ObjectNode object =  structure.retrieve(sToken, revisionDescriptors.getUri());
       
        // check read-own-permissions permission
        Security security = nsaToken.getSecurityHelper();
        security.checkCredentials(sToken, object, config.getReadOwnPermissionsAction());
       
        try {
            String actionsPath = config.getActionsPath();
            Uri actionsPathUri = nsaToken.getUri(sToken, actionsPath);
            ObjectNode actionsPathNode = actionsPathUri.getStore().retrieveObject(actionsPathUri);
            Enumeration actions = actionsPathNode.enumerateChildren();
            while (actions.hasMoreElements()) {
                ActionNode aNode = ActionNode.getActionNode((String)actions.nextElement());
                if (security.hasPermission(sToken, object, aNode)) {
                    xmlValue.add(createPrivilege(aNode.getPath().lastSegment()));
                }
            }
        }
        catch (ServiceAccessException e) {
            throw e;
View Full Code Here

Examples of org.apache.slide.util.XMLValue

     * @throws   ObjectNotFoundException
     * @throws   JDOMException
     */
    public XMLValue computeAcl(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
       
        XMLValue xmlValue = new XMLValue();
       
        NamespaceConfig config = nsaToken.getNamespaceConfig();
        Structure structure = nsaToken.getStructureHelper();
        ObjectNode objectNode =  structure.retrieve(sToken, revisionDescriptors.getUri());
       
        // check read-acl permission
        Security security = nsaToken.getSecurityHelper();
        security.checkCredentials(sToken, objectNode, config.getReadPermissionsAction());
       
        String currentSubjectUri = "";
        boolean currentNegative = false;
        Element currentAceElm = null;
        Element currentGrantDenyElm = null;
        Enumeration permissions = security.enumeratePermissions(sToken, objectNode, true);
        while (permissions.hasMoreElements()) {
            NodePermission perm = (NodePermission)permissions.nextElement();
            if (!perm.getSubjectUri().equals(currentSubjectUri)
                || (perm.isNegative() && !currentNegative || !perm.isNegative() && currentNegative)) {
               
                // save previous ACE
                if (currentAceElm != null) {
                    xmlValue.add(currentAceElm);
                }
               
                // new ACE
                currentAceElm = new Element(E_ACE, DNSP);
               
                // principal
                if (perm.isInvert()) {
                    Element invertElm = new Element(E_INVERT, DNSP);
                    invertElm.addContent(createPrincipalElement(perm.getSubjectUri()));
                    currentAceElm.addContent(invertElm);
                }
                else {
                    currentAceElm.addContent(createPrincipalElement(perm.getSubjectUri()));
                }
               
                // grant/deny
                currentGrantDenyElm = perm.isNegative()
                    ? new Element(E_DENY, DNSP)
                    : new Element(E_GRANT, DNSP);
                currentAceElm.addContent(currentGrantDenyElm);
               
                // inherited
                String inheritedFrom = perm.getInheritedFrom();
                if (inheritedFrom != null && inheritedFrom.length() > 0) {
                    currentAceElm.addContent(createInheritedElement(inheritedFrom));
                }
               
                // protected
                if (perm.isProtected()) {
                    currentAceElm.addContent(new Element(E_PROTECTED, DNSP));
                }
               
                currentSubjectUri = perm.getSubjectUri();
                currentNegative = perm.isNegative();
            }
            currentGrantDenyElm.addContent(createPrivilegeElement(perm.getActionUri()));
        }
       
        // save last ACE
        if (currentAceElm != null) {
            xmlValue.add(currentAceElm);
        }
       
        return xmlValue;
    }
View Full Code Here

Examples of org.apache.slide.util.XMLValue

     * @throws   AccessDeniedException
     * @throws   ObjectNotFoundException
     * @throws   JDOMException
     */
    public XMLValue computePrincipalCollectionSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
        XMLValue xmlValue = new XMLValue();
        NamespaceConfig namespaceConfig = nsaToken.getNamespaceConfig();
       
        xmlValue.addHref(WebdavUtils.getAbsolutePath (namespaceConfig.getUsersPath(),
                                                      contextPath, null, sConf));
       
        if (namespaceConfig.getGroupsPath() != null) {
           
            xmlValue.addHref(WebdavUtils.getAbsolutePath (namespaceConfig.getGroupsPath(),
                                                          contextPath, null, sConf));
        }
        if (namespaceConfig.getRolesPath() != null) {
            xmlValue.addHref(WebdavUtils.getAbsolutePath (namespaceConfig.getRolesPath(),
                                                          contextPath, null, sConf));
        }
        return xmlValue;
    }
View Full Code Here

Examples of org.apache.slide.util.XMLValue

        return xmlValue;
    }
   
   
    public XMLValue computePrivilegeCollectionSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
        XMLValue xmlValue = new XMLValue();
        NamespaceConfig namespaceConfig = nsaToken.getNamespaceConfig();
       
        String absUri = WebdavUtils.getAbsolutePath (namespaceConfig.getActionsPath(),
                                                     contextPath, servletPath, sConf);
       
        xmlValue.addHref(absUri);
        return xmlValue;
    }
View Full Code Here

Examples of org.apache.slide.util.XMLValue

       
        NodeProperty ownerProperty = revisionDescriptor.getProperty(P_OWNER,
                                                                    NodeProperty.DEFAULT_NAMESPACE);
       
  // FIXME wihtout servletPath??
        XMLValue xmlValue = createUserPath(ownerProperty, contextPath);
       
        return xmlValue;
    }
View Full Code Here

Examples of org.apache.slide.util.XMLValue

    public XMLValue computeCreationUser(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
       
        NodeProperty creationUserProperty = revisionDescriptor.getProperty(P_CREATIONUSER,
                                                                           NodeProperty.DEFAULT_NAMESPACE);
  // FIXME wihtout servletPath??
        XMLValue xmlValue = createUserPath(creationUserProperty, contextPath);
       
        return xmlValue;
    }
View Full Code Here

Examples of org.apache.slide.util.XMLValue

       
        NodeProperty modificationUserProperty = revisionDescriptor.getProperty(P_MODIFICATIONUSER,
                                                                               NodeProperty.DEFAULT_NAMESPACE);
       
  // FIXME wihtout servletPath??
        XMLValue xmlValue = createUserPath(modificationUserProperty, contextPath);
       
        return xmlValue;
    }
View Full Code Here

Examples of org.apache.slide.util.XMLValue

        // TODO: find appropriate strategy, e.g. refer to root of namespace
        if (revisionDescriptor.getProperty(P_INHERITED_ACL_SET) != null) {
            Object v = revisionDescriptor.getProperty(P_INHERITED_ACL_SET).getValue();
            return (v instanceof XMLValue)
                ? (XMLValue)v
                : new XMLValue((String)v);
        }
        else {
            return new XMLValue();
        }
    }
View Full Code Here

Examples of org.apache.slide.util.XMLValue

        // no restrictions in Slide implementation?
        if (revisionDescriptor.getProperty(P_ACL_RESTRICTIONS) != null) {
            Object v = revisionDescriptor.getProperty(P_ACL_RESTRICTIONS).getValue();
            return (v instanceof XMLValue)
                ? (XMLValue)v
                : new XMLValue((String)v);
        }
        else {
            return new XMLValue();
        }
    }
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.