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 025import org.fcrepo.kernel.api.auth.WebACAuthorization; 026 027/** 028 * @author whikloj 029 * @author acoburn 030 * @since 2015-08-25 031 */ 032public class WebACAuthorizationImpl implements WebACAuthorization { 033 034 private final Set<String> agents = new HashSet<>(); 035 036 private final Set<String> agentClasses = new HashSet<>(); 037 038 private final Set<URI> modes = new HashSet<>(); 039 040 private final Set<String> accessTo = new HashSet<>(); 041 042 private final Set<String> accessToClass = new HashSet<>(); 043 044 private final Set<String> agentGroups = new HashSet<>(); 045 046 private final Set<String> defaults = new HashSet<>(); 047 048 /** 049 * Constructor 050 * 051 * @param agents The acl:agent values 052 * @param agentClasses the acl:agentClass values 053 * @param modes the acl:mode values 054 * @param accessTo the acl:accessTo values 055 * @param accessToClass the acl:accessToClass values 056 * @param agentGroups the acl:agentGroup values 057 * @param defaults the acl:default values 058 */ 059 public WebACAuthorizationImpl(final Collection<String> agents, final Collection<String> agentClasses, 060 final Collection<URI> modes, final Collection<String> accessTo, 061 final Collection<String> accessToClass, final Collection<String> agentGroups, 062 final Collection<String> defaults) { 063 this.agents.addAll(agents); 064 this.agentClasses.addAll(agentClasses); 065 this.modes.addAll(modes); 066 this.accessTo.addAll(accessTo); 067 this.accessToClass.addAll(accessToClass); 068 this.agentGroups.addAll(agentGroups); 069 this.defaults.addAll(defaults); 070 } 071 072 /** 073 * Get the set of acl:agents, empty set if none. 074 * 075 * @return set of acl:agents 076 */ 077 public Set<String> getAgents() { 078 return agents; 079 } 080 081 /** 082 * Get the set of acl:agentClasses, empty set if none. 083 * 084 * @return set of acl:agentClasses 085 */ 086 public Set<String> getAgentClasses() { 087 return agentClasses; 088 } 089 090 /** 091 * Get the set of acl:modes, empty set if none. 092 * 093 * @return set of acl:modes 094 */ 095 public Set<URI> getModes() { 096 return modes; 097 } 098 099 /** 100 * Get the set of strings directly linked from this ACL, empty set if none. 101 * 102 * @return set of String 103 */ 104 public Set<String> getAccessToURIs() { 105 return accessTo; 106 } 107 108 /** 109 * Get the set of strings describing the rdf:types for this ACL, empty set if none. 110 * 111 * @return set of Strings 112 */ 113 public Set<String> getAccessToClassURIs() { 114 return accessToClass; 115 } 116 117 /** 118 * Get the set of strings describing the agent groups for this ACL, empty set if none. 119 * 120 * @return set of Strings 121 */ 122 public Set<String> getAgentGroups() { 123 return agentGroups; 124 } 125 126 /** 127 * Get the set of strings describing the defaults for this ACL, empty set if none. 128 * 129 * @return set of Strings 130 */ 131 public Set<String> getDefaults() { 132 return defaults; 133 } 134}