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.core.right; 017 018import java.util.Set; 019 020import org.ametys.core.group.GroupIdentity; 021import org.ametys.core.user.UserIdentity; 022 023/** 024 * This interface is for modifiable profile assignments storage 025 */ 026public interface ModifiableProfileAssignmentStorage extends ProfileAssignmentStorage 027{ 028 /* --------------------------------------- */ 029 /* ALLOWED PROFILES FOR ANY CONNECTED USER */ 030 /* --------------------------------------- */ 031 032 /** 033 * Adds allowed profiles any connected user has on the given object 034 * @param object The object 035 * @param profileIds The profiles to add 036 */ 037 public void addAllowedProfilesForAnyConnectedUser(Object object, Set<String> profileIds); 038 039 /** 040 * Removes allowed profiles any connected user has on the given object 041 * @param object The object 042 * @param profileIds The profiles to remove 043 */ 044 public void removeAllowedProfilesForAnyConnectedUser(Object object, Set<String> profileIds); 045 046 047 /* --------------------------------------- */ 048 /* DENIED PROFILES FOR ANY CONNECTED USER */ 049 /* --------------------------------------- */ 050 051 /** 052 * Adds denied profiles any connected user has on the given object 053 * @param object The object 054 * @param profileIds The profiles to add 055 */ 056 public void addDeniedProfilesForAnyConnectedUser(Object object, Set<String> profileIds); 057 058 /** 059 * Removes denied profiles any connected user has on the given object 060 * @param object The object 061 * @param profileIds The profiles to remove 062 */ 063 public void removeDeniedProfilesForAnyConnectedUser(Object object, Set<String> profileIds); 064 065 066 /* ------------------------------ */ 067 /* ALLOWED PROFILES FOR ANONYMOUS */ 068 /* ------------------------------ */ 069 070 /** 071 * Adds allowed profiles an anonymous user has on the given object 072 * @param object The object 073 * @param profileIds The profiles to add 074 */ 075 public void addAllowedProfilesForAnonymous(Object object, Set<String> profileIds); 076 077 /** 078 * Removes allowed profiles an anonymous user has on the given object 079 * @param object The object 080 * @param profileIds The profiles to remove 081 */ 082 public void removeAllowedProfilesForAnonymous(Object object, Set<String> profileIds); 083 084 085 /* --------------------------------------- */ 086 /* DENIED PROFILES FOR ANONYMOUS */ 087 /* --------------------------------------- */ 088 089 /** 090 * Adds denied profiles an anonymous user has on the given object 091 * @param object The object 092 * @param profileIds The profiles to add 093 */ 094 public void addDeniedProfilesForAnonymous(Object object, Set<String> profileIds); 095 096 /** 097 * Removes denied profiles an anonymous user has on the given object 098 * @param object The object 099 * @param profileIds The profiles to remove 100 */ 101 public void removeDeniedProfilesForAnonymous(Object object, Set<String> profileIds); 102 103 104 /* --------------------------- */ 105 /* MANAGEMENT OF ALLOWED USERS */ 106 /* --------------------------- */ 107 108 /** 109 * Associates some users with an allowed profile on a given object 110 * @param users The users to add 111 * @param object The object 112 * @param profileId The id of the profile 113 */ 114 public void addAllowedUsers(Set<UserIdentity> users, Object object, String profileId); 115 116 /** 117 * Removes the association between some users and an allowed profile on a given object 118 * @param users The users to remove 119 * @param object The object 120 * @param profileId The id of the profile 121 */ 122 public void removeAllowedUsers(Set<UserIdentity> users, Object object, String profileId); 123 124 /** 125 * Removes the association between some users and all allowed profiles on a given object 126 * @param users The users to remove 127 * @param object The object 128 */ 129 public void removeAllowedUsers(Set<UserIdentity> users, Object object); 130 131 132 /* ---------------------------- */ 133 /* MANAGEMENT OF ALLOWED GROUPS */ 134 /* ---------------------------- */ 135 136 /** 137 * Associates some groups with an allowed profile on a given object 138 * @param groups The groups to add 139 * @param object The object 140 * @param profileId The id of the profile 141 */ 142 public void addAllowedGroups(Set<GroupIdentity> groups, Object object, String profileId); 143 144 /** 145 * Removes the association between some groups and an allowed profile on a given object 146 * @param groups The groups to remove 147 * @param object The object 148 * @param profileId The id of the profile 149 */ 150 public void removeAllowedGroups(Set<GroupIdentity> groups, Object object, String profileId); 151 152 /** 153 * Removes the association between some groups and all allowed profiles on a given object 154 * @param groups The groups to remove 155 * @param object The object 156 */ 157 public void removeAllowedGroups(Set<GroupIdentity> groups, Object object); 158 159 160 /* ---------------------------- */ 161 /* MANAGEMENT OF DENIED USERS */ 162 /* ---------------------------- */ 163 164 /** 165 * Associates some users with a denied profile on a given object 166 * @param users The users to add 167 * @param object The object 168 * @param profileId The id of the profile 169 */ 170 public void addDeniedUsers(Set<UserIdentity> users, Object object, String profileId); 171 172 /** 173 * Removes the association between some users and an denied profile on a given object 174 * @param users The users to remove 175 * @param object The object 176 * @param profileId The id of the profile 177 */ 178 public void removeDeniedUsers(Set<UserIdentity> users, Object object, String profileId); 179 180 /** 181 * Removes the association between some users and all denied profiles on a given object 182 * @param users The users to remove 183 * @param object The object 184 */ 185 public void removeDeniedUsers(Set<UserIdentity> users, Object object); 186 187 188 /* --------------------------- */ 189 /* MANAGEMENT OF DENIED GROUPS */ 190 /* --------------------------- */ 191 192 /** 193 * Associates some groups with a denied profile on a given object 194 * @param groups The groups to add 195 * @param object The object 196 * @param profileId The id of the profile 197 */ 198 public void addDeniedGroups(Set<GroupIdentity> groups, Object object, String profileId); 199 200 /** 201 * Removes the association between some groups and a denied profile on a given object 202 * @param groups The groups to remove 203 * @param object The object 204 * @param profileId The id of the profile 205 */ 206 public void removeDeniedGroups(Set<GroupIdentity> groups, Object object, String profileId); 207 208 /** 209 * Removes the association between some groups and all denied profiles on a given object 210 * @param groups The groups to remove 211 * @param object The object 212 */ 213 public void removeDeniedGroups(Set<GroupIdentity> groups, Object object); 214 215 216 /* ------ */ 217 /* REMOVE */ 218 /* ------ */ 219 220 /** 221 * Removes all the assignments between this profile and users/groups/anonymous/any connected 222 * @param profileId The profile to remove 223 */ 224 public void removeProfile(String profileId); 225 226 /** 227 * Removes all the assignments involving this user 228 * @param user The user 229 */ 230 public void removeUser(UserIdentity user); 231 232 /** 233 * Removes all the assignments involving this group 234 * @param group The group 235 */ 236 public void removeGroup(GroupIdentity group); 237 238 /* ----------- */ 239 /* INHERITANCE */ 240 /* ----------- */ 241 /** 242 * Allow or disallow inheritance of permissions on the given object 243 * @param object The object 244 * @param disallow true to disallow inheritance, false otherwise 245 */ 246 public void disallowInheritance(Object object, boolean disallow); 247}