
org.fcrepo.auth.roles.common.AccessRolesProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fcrepo-auth-roles-common Show documentation
Show all versions of fcrepo-auth-roles-common Show documentation
This module adds access roles to the repository tree. It creates a REST/JSON API for post and get of access roles on Fedora objects and datastreams. It supports the querying of effective roles by authorization delegates.
/*
* Copyright 2015 DuraSpace, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.fcrepo.auth.roles.common;
import static java.util.Collections.emptyMap;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.modeshape.jcr.value.Path;
/**
* Provides the effective access roles for authorization.
*
* @author Gregory Jansen
* @author whikloj
*/
public interface AccessRolesProvider {
public static final Map> DEFAULT_ACCESS_ROLES = emptyMap();
/**
* Get the roles assigned to this Node. Optionally search up the tree for the effective roles.
*
* @param node the subject Node
* @param effective if true then search for effective roles
* @return a set of roles for each principal
*/
public Map> getRoles(final Node node, final boolean effective);
/**
* Assigns the given set of roles to each principal.
*
* @param node the Node to edit
* @param data the roles to assign
* @throws RepositoryException if repository exception occurred
*/
public void postRoles(final Node node, final Map> data)
throws RepositoryException;
/**
* Deletes all roles assigned on this node and removes the mixin type.
*
* @param node the node to delete
* @throws RepositoryException if delete failed
*/
public void deleteRoles(final Node node) throws RepositoryException;
/**
* Finds effective roles assigned to a path, using first real ancestor node.
*
* @param absPath the real or potential node path
* @param session session
* @return the roles assigned to each principal
* @throws RepositoryException if PathNotFoundException can not handle
*/
public Map> findRolesForPath(final Path absPath,
final Session session) throws RepositoryException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy