add test for authorization

This commit is contained in:
Ken Stevens 2021-12-05 19:31:19 -05:00
parent 0656037c8d
commit 7e04509f4c
2 changed files with 51 additions and 1 deletions

View File

@ -33,7 +33,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
class OperationRule extends BaseRule implements IAuthRule { class OperationRule extends BaseRule implements IAuthRule {
private String myOperationName; private String myOperationName;
private boolean myAppliesToServer; private boolean myAppliesToServer;
private HashSet<Class<? extends IBaseResource>> myAppliesToTypes; private HashSet<Class<? extends IBaseResource>> myAppliesToTypes;
@ -210,4 +209,39 @@ class OperationRule extends BaseRule implements IAuthRule {
myOperationName = theOperationName; myOperationName = theOperationName;
} }
String getOperationName() {
return myOperationName;
}
boolean isAppliesToServer() {
return myAppliesToServer;
}
HashSet<Class<? extends IBaseResource>> getAppliesToTypes() {
return myAppliesToTypes;
}
List<IIdType> getAppliesToIds() {
return myAppliesToIds;
}
HashSet<Class<? extends IBaseResource>> getAppliesToInstancesOfType() {
return myAppliesToInstancesOfType;
}
boolean isAppliesToAnyType() {
return myAppliesToAnyType;
}
boolean isAppliesToAnyInstance() {
return myAppliesToAnyInstance;
}
boolean isAppliesAtAnyLevel() {
return myAppliesAtAnyLevel;
}
boolean isAllowAllResponses() {
return myAllowAllResponses;
}
} }

View File

@ -0,0 +1,16 @@
package ca.uhn.fhir.rest.server.interceptor.auth;
public final class OperationRuleUtil {
private OperationRuleUtil() {}
public static String getOperationName(IAuthRule theRule) {
return ((OperationRule)theRule).getOperationName();
}
public static boolean isAppliesToServer(IAuthRule theRule) {
return ((OperationRule)theRule).isAppliesToServer();
}
public static boolean isAllowAllResponses(IAuthRule theRule) {
return ((OperationRule)theRule).isAllowAllResponses();
}
}