001package ca.uhn.fhir.rest.server.interceptor.auth; 002 003/* 004 * #%L 005 * HAPI FHIR - Server Framework 006 * %% 007 * Copyright (C) 2014 - 2022 Smile CDR, Inc. 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023import java.util.Collection; 024import java.util.List; 025 026import org.hl7.fhir.instance.model.api.IIdType; 027 028public interface IAuthRuleBuilderRuleOpClassifier { 029 030 /** 031 * Rule applies to resources in the given compartment. 032 * <p> 033 * For example, to apply the rule to any observations in the patient compartment 034 * belonging to patient "123", you would invoke this with</br> 035 * <code>inCompartment("Patient", new IdType("Patient", "123"))</code> 036 * </p> 037 * <p> 038 * This call completes the rule and adds the rule to the chain. 039 * </p> 040 * 041 * @param theCompartmentName The name of the compartment (must not be null or blank) 042 * @param theOwner The owner of the compartment. Note that both the resource type and ID must be populated in this ID. 043 */ 044 IAuthRuleBuilderRuleOpClassifierFinished inCompartment(String theCompartmentName, IIdType theOwner); 045 046 /** 047 * Rule applies to resources in the given compartment. 048 * <p> 049 * For example, to apply the rule to any observations in the patient compartment 050 * belonging to patient "123", you would invoke this with</br> 051 * <code>inCompartment("Patient", new IdType("Patient", "123"))</code> 052 * 053 * This call also allows you to pass additional search parameters that count as being included in the given compartment, 054 * passed in as a list of `resourceType:search-parameter-name`. For example, if you select a compartment name of "patient", 055 * you could pass in a singleton list consisting of the string "device:patient", which would cause any devices belonging 056 * to the patient to be permitted by the authorization rule. 057 * 058 * </p> 059 * <p> 060 * This call completes the rule and adds the rule to the chain. 061 * </p> 062 * 063 * @param theCompartmentName The name of the compartment (must not be null or blank) 064 * @param theOwner The owner of the compartment. Note that both the resource type and ID must be populated in this ID. 065 * @param theAdditionalTypeSearchParamNames A list of strings for additional resource types and search parameters which count as being in the compartment, in the form "resourcetype:search-parameter-name". 066 */ 067 IAuthRuleBuilderRuleOpClassifierFinished inCompartmentWithAdditionalSearchParams(String theCompartmentName, IIdType theOwner, AdditionalCompartmentSearchParameters theAdditionalTypeSearchParamNames); 068 069 070 /** 071 * Rule applies to resources in the given compartment. 072 * <p> 073 * For example, to apply the rule to any observations in the patient compartment 074 * belonging to patient "123", you would invoke this with</br> 075 * <code>inCompartment("Patient", new IdType("Patient", "123"))</code> 076 * </p> 077 * <p> 078 * This call completes the rule and adds the rule to the chain. 079 * </p> 080 * 081 * @param theCompartmentName The name of the compartment (must not be null or blank) 082 * @param theOwners The owner of the compartment. Note that both the resource type and ID must be populated in this ID. 083 */ 084 IAuthRuleBuilderRuleOpClassifierFinished inCompartment(String theCompartmentName, Collection<? extends IIdType> theOwners); 085 086 087 /** 088 * Rule applies to resources in the given compartment. 089 * <p> 090 * For example, to apply the rule to any observations in the patient compartment 091 * belonging to patient "123", you would invoke this with</br> 092 * <code>inCompartment("Patient", new IdType("Patient", "123"))</code> 093 * 094 * This call also allows you to pass additional search parameters that count as being included in the given compartment, 095 * passed in as a list of `resourceType:search-parameter-name`. For example, if you select a compartment name of "patient", 096 * you could pass in a singleton list consisting of the string "device:patient", which would cause any devices belonging 097 * to the patient to be permitted by the authorization rule. 098 * 099 * </p> 100 * <p> 101 * This call completes the rule and adds the rule to the chain. 102 * </p> 103 * 104 * @param theCompartmentName The name of the compartment (must not be null or blank) 105 * @param theOwners The owners of the compartment. Note that both the resource type and ID must be populated in these IDs. 106 * @param theAdditionalTypeSearchParamNames A {@link AdditionalCompartmentSearchParameters} which allows you to expand the search space for what is considered "in" the compartment. 107 * 108 **/ 109 IAuthRuleBuilderRuleOpClassifierFinished inCompartmentWithAdditionalSearchParams(String theCompartmentName, Collection<? extends IIdType> theOwners, AdditionalCompartmentSearchParameters theAdditionalTypeSearchParamNames); 110 111 112 /** 113 * Rule applies to any resource instances 114 * <p> 115 * This call completes the rule and adds the rule to the chain. 116 * </p> 117 */ 118 IAuthRuleBuilderRuleOpClassifierFinished withAnyId(); 119}