001/* 002 * Copyright 2025 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.Map; 019import java.util.Set; 020 021import org.ametys.core.group.GroupIdentity; 022import org.ametys.core.user.UserIdentity; 023 024/** 025 * An access controller based on profile 026 */ 027public interface ProfileBasedAccessController extends AccessController 028{ 029 /** 030 * Get an access explanation for every context handled by this controller where the given profile 031 * is used to grant a permission to an anonymous user 032 * @param profileId the profile id 033 * @param workspacesContexts The contexts to tests such as {"/${WorkspaceName}", "/repository", "/admin"} 034 * @return a map of the objects with its explanation 035 */ 036 public Map<ExplanationObject, AccessExplanation> explainAllProfileUsesForAnonymousOnWorkspaces(String profileId, Set<Object> workspacesContexts); 037 038 /** 039 * Get an access explanation for every context handled by this controller where the given profile 040 * is used to grant a permission to any connected user 041 * @param profileId the profile id 042 * @param workspacesContexts The contexts to tests such as {"/${WorkspaceName}", "/repository", "/admin"} 043 * @return a map of the object with its explanation 044 */ 045 public Map<ExplanationObject, AccessExplanation> explainAllProfileUsesForAnyConnectedOnWorkspaces(String profileId, Set<Object> workspacesContexts); 046 047 /** 048 * Get an access explanation for every context handled by this controller where the given profile 049 * is used to grant a permission to a group 050 * @param profileId the profile id 051 * @param workspacesContexts The contexts to tests such as {"/${WorkspaceName}", "/repository", "/admin"} 052 * @return a map of the object with its explanation for each group 053 */ 054 public Map<ExplanationObject, Map<GroupIdentity, AccessExplanation>> explainAllProfileUsesOnWorkspacesByGroups(String profileId, Set<Object> workspacesContexts); 055 056 /** 057 * Get an access explanation for every context handled by this controller where the given profile 058 * is used to grant a permission to a user 059 * @param profileId the profile id 060 * @param workspacesContexts The contexts to tests such as {"/${WorkspaceName}", "/repository", "/admin"} 061 * @return a map of the object with its explanation for each user 062 */ 063 public Map<ExplanationObject, Map<UserIdentity, AccessExplanation>> explainAllProfileUsesOnWorkspacesByUser(String profileId, Set<Object> workspacesContexts); 064}