All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fcrepo.auth.webac.WebACAuthorization Maven / Gradle / Ivy

Go to download

An authorization module for the Fedora Commons Repository framework, implementing the RDF-based WebAccessControl authorization mechanism, as proposed by the W3C. This makes it possible to define fine-grained repository access controls on individual resources or classes of resources to specific users and/or groups.

There is a newer version: 4.7.5
Show newest version
/*
 * Licensed to DuraSpace under one or more contributor license agreements.
 * See the NOTICE file distributed with this work for additional information
 * regarding copyright ownership.
 *
 * DuraSpace licenses this file to you 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.webac;

import java.net.URI;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

/**
 * @author whikloj
 * @author acoburn
 * @since 2015-08-25
 */
public class WebACAuthorization {

    private final Set agents = new HashSet<>();

    private final Set agentClasses = new HashSet<>();

    private final Set modes = new HashSet<>();

    private final Set accessTo = new HashSet<>();

    private final Set accessToClass = new HashSet<>();

    /**
     * Constructor
     *
     * @param agents The acl:agent values
     * @param agentClasses the acl:agentClass values
     * @param modes the acl:mode values
     * @param accessTo the acl:accessTo values
     * @param accessToClass the acl:accessToClass values
     */
    public WebACAuthorization(final Collection agents, final Collection agentClasses,
            final Collection modes, final Collection accessTo, final Collection accessToClass) {
        this.agents.addAll(agents);
        this.agentClasses.addAll(agentClasses);
        this.modes.addAll(modes);
        this.accessTo.addAll(accessTo);
        this.accessToClass.addAll(accessToClass);
    }

    /**
     * Get the set of acl:agents, empty set if none.
     *
     * @return set of acl:agents
     */
    public Set getAgents() {
        return agents;
    }

    /**
     * Get the set of acl:agentClasses, empty set if none.
     * 
     * @return set of acl:agentClasses
     */
    public Set getAgentClasses() {
        return agentClasses;
    }

    /**
     * Get the set of acl:modes, empty set if none.
     *
     * @return set of acl:modes
     */
    public Set getModes() {
        return modes;
    }

    /**
     * Get the set of strings directly linked from this ACL, empty set if none.
     *
     * @return set of String
     */
    public Set getAccessToURIs() {
        return accessTo;
    }

    /**
     * Get the set of strings describing the rdf:types for this ACL, empty set if none.
     *
     * @return set of Strings
     */
    public Set getAccessToClassURIs() {
        return accessToClass;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy