001/*
002 * Licensed to DuraSpace under one or more contributor license agreements.
003 * See the NOTICE file distributed with this work for additional information
004 * regarding copyright ownership.
005 *
006 * DuraSpace licenses this file to you under the Apache License,
007 * Version 2.0 (the "License"); you may not use this file except in
008 * compliance with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.fcrepo.auth.webac;
019
020import java.net.URI;
021import java.util.Collection;
022import java.util.HashSet;
023import java.util.Set;
024
025/**
026 * @author whikloj
027 * @author acoburn
028 * @since 2015-08-25
029 */
030public class WebACAuthorization {
031
032    private final Set<String> agents = new HashSet<>();
033
034    private final Set<String> agentClasses = new HashSet<>();
035
036    private final Set<URI> modes = new HashSet<>();
037
038    private final Set<String> accessTo = new HashSet<>();
039
040    private final Set<String> accessToClass = new HashSet<>();
041
042    private final Set<String> agentGroups = new HashSet<>();
043
044    private final Set<String> defaults = new HashSet<>();
045
046    /**
047     * Constructor
048     *
049     * @param agents The acl:agent values
050     * @param agentClasses the acl:agentClass values
051     * @param modes the acl:mode values
052     * @param accessTo the acl:accessTo values
053     * @param accessToClass the acl:accessToClass values
054     * @param agentGroups the acl:agentGroup values
055     * @param defaults the acl:default values
056     */
057    public WebACAuthorization(final Collection<String> agents, final Collection<String> agentClasses,
058            final Collection<URI> modes, final Collection<String> accessTo, final Collection<String> accessToClass,
059            final Collection<String> agentGroups, final Collection<String> defaults) {
060        this.agents.addAll(agents);
061        this.agentClasses.addAll(agentClasses);
062        this.modes.addAll(modes);
063        this.accessTo.addAll(accessTo);
064        this.accessToClass.addAll(accessToClass);
065        this.agentGroups.addAll(agentGroups);
066        this.defaults.addAll(defaults);
067    }
068
069    /**
070     * Get the set of acl:agents, empty set if none.
071     *
072     * @return set of acl:agents
073     */
074    public Set<String> getAgents() {
075        return agents;
076    }
077
078    /**
079     * Get the set of acl:agentClasses, empty set if none.
080     * 
081     * @return set of acl:agentClasses
082     */
083    public Set<String> getAgentClasses() {
084        return agentClasses;
085    }
086
087    /**
088     * Get the set of acl:modes, empty set if none.
089     *
090     * @return set of acl:modes
091     */
092    public Set<URI> getModes() {
093        return modes;
094    }
095
096    /**
097     * Get the set of strings directly linked from this ACL, empty set if none.
098     *
099     * @return set of String
100     */
101    public Set<String> getAccessToURIs() {
102        return accessTo;
103    }
104
105    /**
106     * Get the set of strings describing the rdf:types for this ACL, empty set if none.
107     *
108     * @return set of Strings
109     */
110    public Set<String> getAccessToClassURIs() {
111        return accessToClass;
112    }
113
114    /**
115     * Get the set of strings describing the agent groups for this ACL, empty set if none.
116     *
117     * @return set of Strings
118     */
119    public Set<String> getAgentGroups() {
120        return agentGroups;
121    }
122
123    /**
124     * Get the set of strings describing the defaults for this ACL, empty set if none.
125     *
126     * @return set of Strings
127     */
128    public Set<String> getDefaults() {
129        return defaults;
130    }
131}