001/* 002 * Copyright 2016 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.plugins.repository; 017 018import java.util.Map; 019import java.util.Set; 020 021import org.ametys.core.group.GroupIdentity; 022import org.ametys.core.user.UserIdentity; 023 024/** 025 * {@link AmetysObject} that can hold its profile assignments. 026 */ 027public interface ACLAmetysObject extends AmetysObject 028{ 029 /** 030 * Gets the allowed profiles any connected user has on this ametys object 031 * @return the allowed profiles any connected user has on this ametys object 032 */ 033 public Set<String> getAllowedProfilesForAnyConnectedUser(); 034 035 /** 036 * Gets the denied profiles any connected user has on this ametys object 037 * @return the denied profiles any connected user has on this ametys object 038 */ 039 public Set<String> getDeniedProfilesForAnyConnectedUser(); 040 041 /** 042 * Gets the allowed profiles an anonymous user has on this ametys object 043 * @return the allowed profiles an anonymous user has on this ametys object 044 */ 045 public Set<String> getAllowedProfilesForAnonymous(); 046 047 /** 048 * Gets the denied profiles an anonymous user has on this ametys object 049 * @return the denied profiles an anonymous user has on this ametys object 050 */ 051 public Set<String> getDeniedProfilesForAnonymous(); 052 053 /** 054 * Gets the allowed profiles assigned on this ametys object for this user 055 * @param user The user identity 056 * @return The allowed profiles 057 */ 058 public Set<String> getAllowedProfilesForUser(UserIdentity user); 059 060 /** 061 * Gets the users that have allowed profiles assigned on this ametys object 062 * @return The map of allowed users (keys) with their assigned profiles (values) 063 */ 064 public Map<UserIdentity, Set<String>> getAllowedProfilesForUsers(); 065 066 /** 067 * Gets the users that have the given allowed profile on this ametys object 068 * @param profileId The id of the profile 069 * @return The allowed users with that profile on this ametys object 070 */ 071 public Set<UserIdentity> getAllowedUsers(String profileId); 072 073 /** 074 * Gets the groups that have allowed profiles assigned on this ametys object 075 * @return The map of allowed groups (keys) with their assigned profiles (values) 076 */ 077 public Map<GroupIdentity, Set<String>> getAllowedProfilesForGroups(); 078 079 /** 080 * Gets the groups that have the given allowed profile on this ametys object 081 * @param profileId The id of the profile 082 * @return The allowed groups with that profile on that object 083 */ 084 public Set<GroupIdentity> getAllowedGroups(String profileId); 085 086 /** 087 * Gets the denied profiles assigned on this ametys object for this user 088 * @param user The user identity 089 * @return The denied profiles 090 */ 091 public Set<String> getDeniedProfilesForUser(UserIdentity user); 092 093 /** 094 * Gets the users that have denied profiles assigned on this ametys object 095 * @return The map of denied users (keys) with their assigned profiles (values) 096 */ 097 public Map<UserIdentity, Set<String>> getDeniedProfilesForUsers(); 098 099 /** 100 * Gets the users that have the given denied profile on this ametys object 101 * @param profileId The id of the profile 102 * @return The denied users with that profile on this ametys object 103 */ 104 public Set<UserIdentity> getDeniedUsers(String profileId); 105 106 /** 107 * Gets the groups that have allowed profiles assigned on this ametys object 108 * @return The map of denied groups (keys) with their assigned profiles (values) 109 */ 110 public Map<GroupIdentity, Set<String>> getDeniedProfilesForGroups(); 111 112 /** 113 * Gets the groups that have the given allowed profile on this ametys object 114 * @param profileId The id of the profile 115 * @return The denied groups with that profile on this ametys object 116 */ 117 public Set<GroupIdentity> getDeniedGroups(String profileId); 118 119 /** 120 * Returns true if the inheritance is disallow for this ametys object 121 * @return true if the inheritance is disallow for this ametys object 122 */ 123 public boolean isInheritanceDisallowed(); 124}