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

org.fcrepo.auth.webac.WebACAuthorizationImpl 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: 6.5.1
Show newest version
/*
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree.
 */
package org.fcrepo.auth.webac;

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

import org.fcrepo.kernel.api.auth.WebACAuthorization;

/**
 * @author whikloj
 * @author acoburn
 * @since 2015-08-25
 */
public class WebACAuthorizationImpl implements 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<>();

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

    private final Set defaults = 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
     * @param agentGroups the acl:agentGroup values
     * @param defaults the acl:default values
     */
    public WebACAuthorizationImpl(final Collection agents, final Collection agentClasses,
                                  final Collection modes, final Collection accessTo,
                                  final Collection accessToClass, final Collection agentGroups,
                                  final Collection defaults) {
        this.agents.addAll(agents);
        this.agentClasses.addAll(agentClasses);
        this.modes.addAll(modes);
        this.accessTo.addAll(accessTo);
        this.accessToClass.addAll(accessToClass);
        this.agentGroups.addAll(agentGroups);
        this.defaults.addAll(defaults);
    }

    /**
     * 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;
    }

    /**
     * Get the set of strings describing the agent groups for this ACL, empty set if none.
     *
     * @return set of Strings
     */
    public Set getAgentGroups() {
        return agentGroups;
    }

    /**
     * Get the set of strings describing the defaults for this ACL, empty set if none.
     *
     * @return set of Strings
     */
    public Set getDefaults() {
        return defaults;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy