Package org.apache.slide.structure

Examples of org.apache.slide.structure.ObjectNode$ParentBindingList


                               Enumeration permissions)
        throws ServiceAccessException, ObjectNotFoundException,
        AccessDeniedException {
       
        Uri objectUri = namespace.getUri(token, object);
        ObjectNode objectNode = objectUri.getStore().retrieveObject(objectUri);
       
        checkCredentials(token, objectNode,
                         namespaceConfig.getGrantPermissionAction());
        checkCredentials(token, objectNode,
                         namespaceConfig.getRevokePermissionAction());
View Full Code Here


    public void grantPermission(SlideToken token,
                                NodePermission permission)
        throws ServiceAccessException, ObjectNotFoundException,
        AccessDeniedException {
        Uri objectUri = namespace.getUri(token, permission.getObjectUri());
        ObjectNode object = objectUri.getStore()
            .retrieveObject(objectUri);
       
        // Checking if the permission is already present
        Enumeration permissions = enumeratePermissions(token, object);
        boolean alreadyPresent = false;
View Full Code Here

    public void revokePermission(SlideToken token, NodePermission permission)
        throws ServiceAccessException, ObjectNotFoundException,
        AccessDeniedException {
       
        Uri objectUri = namespace.getUri(token, permission.getObjectUri());
        ObjectNode object = objectUri.getStore().retrieveObject(objectUri);
       
        checkCredentials(token, object,
                         namespaceConfig.getRevokePermissionAction());
        objectUri.getStore().revokePermission(objectUri, permission);
    }
View Full Code Here

                Boolean permission = token.checkPermissionCache(object, action);
                if (permission == null) {
                    // if not checked before, check now
                    try {
                        Uri objectUri = namespace.getUri(token, object.getUri());
                        ObjectNode realObject = objectUri.getStore()
                            .retrieveObject(objectUri);
                        checkPermission(token, realObject, action);
                        token.cachePermission(object, action, true);
                    } catch (AccessDeniedException ade) {
                        token.cachePermission(object, action, false);
View Full Code Here

       
        boolean granted = false;
        boolean denied = false;
        boolean rootObjectReached = false;
       
        ObjectNode courObject = object;
       
        Uri subjectUri = namespace.getUri(subject.getUri());
        Uri actionUri = namespace.getUri(action.getUri());
       
        // check if allready granded
       
        while (!granted && !denied && !rootObjectReached) {
           
            Uri courUri = namespace.getUri(courObject.getUri());
            Enumeration permissions = courUri.getStore()
                .enumeratePermissions(courUri);
           
            while (permissions.hasMoreElements()) {
               
                boolean oldGranted = granted;
                boolean oldDenied = denied;
               
                NodePermission permission =
                    (NodePermission) permissions.nextElement();
                String permissionSubject = permission.getSubjectUri();
               
                if (permissionSubject == SubjectNode.SELF_URI) {
                   
                    boolean check;
                    check = object.getUri().equals(subjectUri.toString());
                    if (permission.isInheritable()) {
                        String subjectUriString = subjectUri.toString();
                        if(!subjectUriString.endsWith("/"))
                            subjectUriString = subjectUriString + "/";
                       
                        check |= object.getUri().startsWith(subjectUriString);
                    }
                   
                    // Self permission
                    granted = (!permission.isNegative())
                        && (check)
                        && (actionUri.toString()
                                .startsWith(permission.getActionUri()));
                    denied = (permission.isNegative())
                        && (check)
                        && (actionUri.toString()
                                .startsWith(permission.getActionUri()));
                   
                } else if (permission.isInheritable()
                           || permission.getObjectUri().equals(object.getUri())) {
                   
                    if (permissionSubject.startsWith("/")) {
                       
                        // Node permission
                       
                        String permSubj = permission.getSubjectUri();
                        if(!permSubj.endsWith("/"))
                            permSubj = permSubj + "/";
                        boolean match = subjectUri.toString().
                            equals(permission.getSubjectUri()) ||
                            subjectUri.toString().startsWith(permSubj);
                        match &= actionUri.toString().
                            startsWith(permission.getActionUri());
                       
                        granted = (!permission.isNegative()) && match;
                        denied = permission.isNegative() && match;
                       
                    } else if (permissionSubject.startsWith("+")) {
                       
                        // Permission group which needs to be expanded
                        Uri permissionSubjectUri =
                            namespace.getUri(permissionSubject.substring(1));
                        ObjectNode group =
                            permissionSubjectUri.getStore().retrieveObject
                            (permissionSubjectUri);
                        // if the node is a GroupNode, expand it out to
                        // normal permissions
                        if (group instanceof
                            org.apache.slide.structure.GroupNode ) {
                            if (group.hasChildren()) {
                                Enumeration groupMembers =
                                    group.enumerateChildren();
                                // parse thru the children of the group and
                                // check permissions on each
                                while (groupMembers.hasMoreElements()) {
                                   
                                    oldGranted = granted;
                                    oldDenied = denied;
                                   
                                    Uri childUri =
                                        namespace.getUri
                                        ((String) groupMembers.nextElement());
                                    ObjectNode childNode =
                                        childUri.getStore().retrieveObject
                                        (childUri);
                                    String childSubjectUri = childNode
                                        instanceof LinkNode ?
                                        ((LinkNode) childNode)
                                        .getLinkedUri() :
                                        childNode.getUri() ;
                                   
                                    String testUri;
                                    if(!childSubjectUri.endsWith("/"))
                                        testUri = childSubjectUri+"/";
                                    else
View Full Code Here

        Uri objectUri = namespace.getUri(token, object);
        if (!includeInherited) {
            return objectUri.getStore().enumeratePermissions(objectUri);
        }
        else {
            ObjectNode objectNode = objectUri.getStore().retrieveObject(objectUri);
            Iterator i = retrieveAclSourceNodes(token, objectNode).iterator();
            Vector permissions = new Vector();
            while (i.hasNext()) {
                ObjectNode oNode = (ObjectNode)i.next();
                Uri oUri = namespace.getUri(token, oNode.getUri());
                Enumeration permEnum = oUri.getStore().enumeratePermissions(oUri);
                while (permEnum.hasMoreElements()) {
                    NodePermission perm = (NodePermission)permEnum.nextElement();
                    if (object.equals(oNode.getUri())) {
                        permissions.add(perm);
                    }
                    else if (perm.isInheritable()) {
                        perm.setInheritedFrom(oNode.getUri());
                        permissions.add(perm);
                    }
                }
            }
            return permissions.elements();
View Full Code Here

     * in the DataSource
     */
    public boolean hasRole(SlideToken token, String role)
        throws ServiceAccessException, ObjectNotFoundException {
       
        ObjectNode subject = getPrincipal(token);
       
        return hasRole(subject, role);
       
    }
View Full Code Here

                throw e;
            }
            else {
                try {
                    Uri parentUri = subjectUri.getParentUri();
                    ObjectNode parent =
                        subjectUri.getStore().retrieveObject(parentUri);
                    Enumeration childrenEnum = parent.enumerateChildren();
                    Enumeration linksEnum = parent.enumerateLinks();
                    Vector children = new Vector();
                    while (childrenEnum.hasMoreElements()) {
                        children.addElement(childrenEnum.nextElement());
                    }
                    children.addElement(subjectUri.toString());
                    Vector links = new Vector();
                    while (linksEnum.hasMoreElements()) {
                        links.addElement(linksEnum.nextElement());
                    }
                   
                    // First, load the object's class
                    Class objectClass = Class.forName
                        (namespaceConfig.getAutoCreateUsersRole());
                    Class[] types = { String.class };
                    Object[] args = { subjectUri.toString() };
                    Constructor constructor =
                        objectClass.getConstructor(types);
                    ObjectNode object =
                        (ObjectNode) constructor.newInstance(args);
                    subjectUri.getStore().createObject(subjectUri, object);
                   
                    Class[] types2 =
                    { String.class, Vector.class, Vector.class };
View Full Code Here

        try {
            actionAggregation = new HashMap();
            actionAggregationClosure = new HashMap();
            String actionsPath = namespaceConfig.getActionsPath();
            Uri actionsPathUri = namespace.getUri(actionsPath);
            ObjectNode actionsPathNode = actionsPathUri.getStore().retrieveObject(actionsPathUri);
            Enumeration actions = actionsPathNode.enumerateChildren();
            while (actions.hasMoreElements()) {
                ActionNode aNode = ActionNode.getActionNode((String)actions.nextElement());
                Set directAggregates = getActionAggregates(aNode);
                actionAggregation.put(aNode, directAggregates);
                Set aClosure = new HashSet();
View Full Code Here

        if (uri instanceof ResourceId) {
            super.storeObject(uri, object);
        }
        else {
            ResourceId resourceId = obtainResourceId(uri);
            ObjectNode objectClone = object.cloneObject();
            objectClone.setUri(resourceId.getUuri()); // switch to uuri
            resourceId.getStore().storeObject(resourceId, objectClone);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.slide.structure.ObjectNode$ParentBindingList

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.