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.right.ProfileAssignmentStorage.AnonymousOrAnyConnectedKeys;
023import org.ametys.core.right.ProfileAssignmentStorage.UserOrGroup;
024import org.ametys.core.user.UserIdentity;
025
026/**
027 * {@link AmetysObject} that can hold its profile assignments.
028 */
029public interface ACLAmetysObject extends AmetysObject
030{
031    /**
032     * Gets the allowed profiles any connected user has on the given object
033     * @return a map containing allowed/denied profiles that anonymous and any connected user has on the given object
034     */
035    public Map<AnonymousOrAnyConnectedKeys, Set<String>> getProfilesForAnonymousAndAnyConnectedUser();
036    
037    /**
038     * Gets the users that have allowed profiles assigned on the given object
039     * @param user The user to get profiles for. Can be null to get profiles for all users that have rights
040     * @return The map of allowed users with their assigned allowed/denied profiles
041     */
042    public Map<UserIdentity, Map<UserOrGroup, Set<String>>> getProfilesForUsers(UserIdentity user);
043    
044    /**
045     * Gets the groups that have allowed profiles assigned on the given object
046     * @param groups The group to get profiles for. Can be null to get profiles for all groups that have rights
047     * @return The map of allowed/denied groups with their assigned profiles
048     */
049    public Map<GroupIdentity, Map<UserOrGroup, Set<String>>> getProfilesForGroups(Set<GroupIdentity> groups);
050    
051    /**
052     * Returns true if the inheritance is disallow for this ametys object
053     * @return true if the inheritance is disallow for this ametys object
054     */
055    public boolean isInheritanceDisallowed();
056}