001/*- 002 * #%L 003 * HAPI FHIR - Server Framework 004 * %% 005 * Copyright (C) 2014 - 2024 Smile CDR, Inc. 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package ca.uhn.fhir.rest.server.interceptor.auth; 021 022import jakarta.annotation.Nonnull; 023import org.hl7.fhir.instance.model.api.IIdType; 024 025import java.util.Collection; 026import java.util.stream.Collectors; 027 028/** 029 * @since 5.5.0 030 */ 031public interface IAuthRuleBuilderRuleBulkExport { 032 033 /** 034 * Allow/deny <b>group-level</b> export rule applies to the Group with the given resource ID, e.g. <code>Group/123</code> 035 * 036 * @since 5.5.0 037 */ 038 default IAuthRuleBuilderRuleBulkExportWithTarget groupExportOnGroup(@Nonnull IIdType theFocusResourceId) { 039 return groupExportOnGroup(theFocusResourceId.getValue()); 040 } 041 042 /** 043 * Allow/deny <b>group-level</b> export rule applies to the Group with the given resource ID, e.g. <code>Group/123</code> 044 * 045 * @since 5.5.0 046 */ 047 IAuthRuleBuilderRuleBulkExportWithTarget groupExportOnGroup(@Nonnull String theFocusResourceId); 048 049 /** 050 * Allow/deny <b>patient-level</b> export rule applies to the Group with the given resource ID, e.g. <code>Group/123</code> 051 * 052 * @since 5.5.0 053 */ 054 default IAuthRuleBuilderRuleBulkExportWithTarget patientExportOnGroup(@Nonnull IIdType theFocusResourceId) { 055 return patientExportOnGroup(theFocusResourceId.getValue()); 056 } 057 058 IAuthRuleBuilderRuleBulkExportWithTarget patientExportOnPatient(@Nonnull String theFocusResourceId); 059 060 IAuthRuleBuilderRuleBulkExportWithTarget patientExportOnAllPatients(); 061 062 default IAuthRuleBuilderRuleBulkExportWithTarget patientExportOnPatient(@Nonnull IIdType theFocusResourceId) { 063 return patientExportOnPatient(theFocusResourceId.getValue()); 064 } 065 066 default IAuthRuleBuilderRuleBulkExportWithTarget patientExportOnPatients( 067 @Nonnull Collection<IIdType> theFocusResourceIds) { 068 return patientExportOnPatientStrings( 069 theFocusResourceIds.stream().map(IIdType::getValue).collect(Collectors.toList())); 070 } 071 072 IAuthRuleBuilderRuleBulkExportWithTarget patientExportOnPatientStrings(Collection<String> theFocusResourceIds); 073 074 /** 075 * Allow/deny <b>patient-level</b> export rule applies to the Group with the given resource ID, e.g. <code>Group/123</code> 076 * 077 * @since 5.5.0 078 */ 079 IAuthRuleBuilderRuleBulkExportWithTarget patientExportOnGroup(@Nonnull String theFocusResourceId); 080 081 /** 082 * Allow/deny <b>system-level</b> export rule applies to the Group with the given resource ID, e.g. <code>Group/123</code> 083 * 084 * @since 5.5.0 085 */ 086 IAuthRuleBuilderRuleBulkExportWithTarget systemExport(); 087 088 /** 089 * Allow/deny <b>any bulk export</b> operation 090 */ 091 IAuthRuleBuilderRuleBulkExportWithTarget any(); 092}