Examples of AccessManager


Examples of org.apache.jackrabbit.core.security.AccessManager

    }

    private void checkPermission(ItemImpl item, int perm) throws RepositoryException {
        if (perm > Permission.NONE) {
            SessionImpl sImpl = (SessionImpl) item.getSession();
            AccessManager acMgr = sImpl.getAccessManager();

            Path path = item.getPrimaryPath();
            acMgr.checkPermission(path, perm);
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.AccessManager

    }

    private void checkPermission(NodeImpl node, Name childName, int perm) throws RepositoryException {
        if (perm > Permission.NONE) {
            SessionImpl sImpl = (SessionImpl) node.getSession();
            AccessManager acMgr = sImpl.getAccessManager();

            boolean isGranted = acMgr.isGranted(node.getPrimaryPath(), childName, perm);
            if (!isGranted) {
                throw new AccessDeniedException("Permission denied.");
            }
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.AccessManager

        since there is no specific privilege for reordering child nodes,
        test if the the node to be reordered can be removed and added,
        i.e. treating reorder similar to a move.
        TODO: properly deal with sns in which case the index would change upon reorder.
        */
        AccessManager acMgr = sessionContext.getAccessManager();
        PathBuilder pb = new PathBuilder(getPrimaryPath());
        pb.addLast(srcName.getName(), srcName.getIndex());
        Path childPath = pb.getPath();
        if (!acMgr.isGranted(childPath, Permission.ADD_NODE | Permission.REMOVE_NODE)) {
            String msg = "Not allowed to reorder child node " + sessionContext.getJCRPath(childPath) + ".";
            log.debug(msg);
            throw new AccessDeniedException(msg);
        }

View Full Code Here

Examples of org.apache.jackrabbit.core.security.AccessManager

            throw new ItemExistsException(
                    "Same name siblings not allowed: " + existing);
        }

        // check permissions
        AccessManager acMgr = sessionContext.getAccessManager();
        if (!(acMgr.isGranted(getPrimaryPath(), Permission.REMOVE_NODE) &&
                acMgr.isGranted(parent.getPrimaryPath(), qName, Permission.ADD_NODE | Permission.NODE_TYPE_MNGMT))) {
            String msg = "Not allowed to rename node " + safeGetJCRPath() + " to " + newName;
            log.debug(msg);
            throw new AccessDeniedException(msg);
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.AccessManager

        Privilege[] privs = privilegesFromName(privName.toString());
        assertEquals(isAllow, getTestACManager().hasPrivileges(null, privs));
    }

    private void assertPermission(int permission, boolean isAllow) throws Exception {
        AccessManager acMgr = ((SessionImpl) getTestSession()).getAccessManager();
        try {
            acMgr.checkRepositoryPermission(permission);
            if (!isAllow) {
                fail();
            }
        } catch (AccessDeniedException e) {
            if (isAllow) {
View Full Code Here

Examples of org.apache.jackrabbit.core.security.AccessManager

        }

        NodeId targetId = targetNode.getNodeId();

        // check permissions
        AccessManager acMgr = context.getAccessManager();
        if (!(acMgr.isGranted(srcPath, Permission.REMOVE_NODE) &&
                acMgr.isGranted(destPath, Permission.ADD_NODE | Permission.NODE_TYPE_MNGMT))) {
            String msg = "Not allowed to move node " + srcAbsPath + " to " + destAbsPath;
            log.debug(msg);
            throw new AccessDeniedException(msg);
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.AccessManager

        }

        // 3. access rights

        if ((options & CHECK_ACCESS) == CHECK_ACCESS) {
            AccessManager accessMgr = context.getAccessManager();
            // make sure current session is granted read access on parent node
            if (!accessMgr.isGranted(parentPath, Permission.READ)) {
                throw new ItemNotFoundException(safeGetJCRPath(parentState.getNodeId()));
            }
            // make sure current session is granted write access on parent node
            if (!accessMgr.isGranted(parentPath, nodeName, Permission.ADD_NODE)) {
                throw new AccessDeniedException(safeGetJCRPath(parentState.getNodeId())
                        + ": not allowed to add child node");
            }
            // make sure the editing session is allowed create nodes with a
            // specified node type (and ev. mixins)
            if (!accessMgr.isGranted(parentPath, nodeName, Permission.NODE_TYPE_MNGMT)) {
                throw new AccessDeniedException(safeGetJCRPath(parentState.getNodeId())
                        + ": not allowed to add child node");
            }
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.AccessManager

        // 3. access rights

        if ((options & CHECK_ACCESS) == CHECK_ACCESS) {
            try {
                AccessManager accessMgr = context.getAccessManager();
                // make sure current session is granted read access on parent node
                if (!accessMgr.isGranted(targetPath, Permission.READ)) {
                    throw new PathNotFoundException(safeGetJCRPath(targetPath));
                }
                // make sure current session is allowed to remove target node
                if (!accessMgr.isGranted(targetPath, Permission.REMOVE_NODE)) {
                    throw new AccessDeniedException(safeGetJCRPath(targetPath)
                            + ": not allowed to remove node");
                }
            } catch (ItemNotFoundException infe) {
                String msg = "internal error: failed to check access rights for "
View Full Code Here

Examples of org.apache.jackrabbit.core.security.AccessManager

        NodeState node = getNodeState(nodePath);

        // access rights
        // make sure current session is granted read access on node
        AccessManager accessMgr = context.getAccessManager();
        if (!accessMgr.isGranted(nodePath, Permission.READ)) {
            throw new PathNotFoundException(safeGetJCRPath(node.getNodeId()));
        }
        // TODO: removed check for 'WRITE' permission on node due to the fact,
        // TODO: that add_node and set_property permission are granted on the
        // TODO: items to be create/modified and not on their parent.
View Full Code Here

Examples of org.apache.jackrabbit.core.security.AccessManager

     */
    public void verifyCanRead(Path nodePath)
            throws PathNotFoundException, RepositoryException {
        // access rights
        // make sure current session is granted read access on node
        AccessManager accessMgr = context.getAccessManager();
        if (!accessMgr.isGranted(nodePath, Permission.READ)) {
            throw new PathNotFoundException(safeGetJCRPath(nodePath));
        }
    }
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.