Package org.apache.jackrabbit.api.security.user

Examples of org.apache.jackrabbit.api.security.user.AuthorizableExistsException


    private void checkValidID(String id) throws RepositoryException {
        if (id == null || id.length() == 0) {
            throw new IllegalArgumentException("Invalid ID " + id);
        } else if (getAuthorizable(id) != null) {
            throw new AuthorizableExistsException("Authorizable with ID " + id + " already exists");
        }
    }
View Full Code Here


        }
        if (!isGroup && EveryonePrincipal.NAME.equals(principal.getName())) {
            throw new IllegalArgumentException("'everyone' is a reserved group principal name.");
        }
        if (getAuthorizable(principal) != null) {
            throw new AuthorizableExistsException("Authorizable with principal " + principal.getName() + " already exists.");
        }
    }
View Full Code Here

         used to look for an colliding authorizable still finds the persisted
         node.
        */
        Authorizable existing = getAuthorizable(principal);
        if (existing != null && !((AuthorizableImpl) existing).getNode().isSame(node)) {
            throw new AuthorizableExistsException("Authorizable for '" + principal.getName() + "' already exists: ");
        }
        if (!node.isNew() || node.hasProperty(P_PRINCIPAL_NAME)) {
            throw new RepositoryException("rep:principalName can only be set once on a new node.");
        }
        setProperty(node, P_PRINCIPAL_NAME, getValue(principal.getName()), true);
View Full Code Here

    private void checkValidID(String id) throws IllegalArgumentException, AuthorizableExistsException, RepositoryException {
        if (id == null || id.length() == 0) {
            throw new IllegalArgumentException("Cannot create authorizable: ID can neither be null nor empty String.");
        }
        if (internalGetAuthorizable(id) != null) {
            throw new AuthorizableExistsException("User or Group for '" + id + "' already exists");
        }
    }
View Full Code Here

        }

        private void checkAuthorizableNodeExists(String nodeName, Node folder) throws AuthorizableExistsException, RepositoryException {
            if (folder.hasNode(nodeName) &&
                    ((NodeImpl) folder.getNode(nodeName)).isNodeType(NT_REP_AUTHORIZABLE)) {
                throw new AuthorizableExistsException("Unable to create Group/User: Collision with existing authorizable.");
            }
        }
View Full Code Here

    private void checkValidID(String id) throws RepositoryException {
        if (id == null || id.length() == 0) {
            throw new IllegalArgumentException("Invalid ID " + id);
        } else if (getAuthorizable(id) != null) {
            throw new AuthorizableExistsException("Authorizable with ID " + id + " already exists");
        }
    }
View Full Code Here

            String id = propInfo.getTextValue().getString();
            Authorizable existing = userManager.getAuthorizable(id);
            if (a.getPath().equals(existing.getPath())) {
                parent.setProperty(REP_AUTHORIZABLE_ID, id);
            } else {
                throw new AuthorizableExistsException(id);
            }
        } else if (REP_PRINCIPAL_NAME.equals(propName)) {
            if (!isValid(def, NT_REP_AUTHORIZABLE, false)) {
                return false;
            }
View Full Code Here

            String id = propInfo.getTextValue().getString();
            Authorizable existing = userManager.getAuthorizable(id);
            if (a.getPath().equals(existing.getPath())) {
                parent.setProperty(REP_AUTHORIZABLE_ID, id);
            } else {
                throw new AuthorizableExistsException(id);
            }
        } else if (REP_PRINCIPAL_NAME.equals(propName)) {
            if (!isValid(def, NT_REP_AUTHORIZABLE, false)) {
                return false;
            }
View Full Code Here

        List refereeValues = getRefereeValues();
        if (refereeValues.contains(princValue) || getPrincipal().getName().equals(principalName)) {
            return false;
        }
        if (userManager.hasAuthorizableOrReferee(principal)) {
            throw new AuthorizableExistsException("Another authorizable already represented by or refeering to " +  principalName);
        }
        refereeValues.add(princValue);

        userManager.setProtectedProperty(node, P_REFEREES, (Value[]) refereeValues.toArray(new Value[refereeValues.size()]));
        return true;
View Full Code Here

        }
        if (!isValidPrincipal(principal)) {
            throw new IllegalArgumentException("Cannot create user: Principal may not be null and must have a valid name.");           
        }
        if (getAuthorizable(userID) != null) {
            throw new AuthorizableExistsException("User for '" + userID + "' already exists");
        }
        if (hasAuthorizableOrReferee(principal)) {
            throw new AuthorizableExistsException("Authorizable for '" + principal.getName() + "' already exists");
        }

        NodeImpl parent = null;
        try {
            String parentPath = getParentPath(intermediatePath, getCurrentUserPath());
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.api.security.user.AuthorizableExistsException

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.