Class SmartClinicalScope

java.lang.Object
ca.cdr.api.security.SmartClinicalScope
All Implemented Interfaces:
Comparable<SmartClinicalScope>

public final class SmartClinicalScope extends Object implements Comparable<SmartClinicalScope>
Parsed smart scope for access to clinical data. ... Only clinical scopes; not used for context, identity, or extension scopes.
  • Method Details

    • fromScopeString

      Inspect the scope, and parse if it is a resource access scope. e.g. "patient/*.read?code=foo" will parse, but "openid" will not.
      Parameters:
      theScope - the requested scope
      Returns:
      a parsed SmartClinicalScope if the scope affected resource access.
    • getPrefix

      @Nonnull public String getPrefix()
      Get the prefix. E.g. "patient" from patient/Observation.read
    • getResourceType

      @Nonnull public String getResourceType()
      Get the resource scope. E.g. "Observation" from patient/Observation.read Can be "*"
    • isStarType

      public boolean isStarType()
      Is the resource scope "*". E.g. patient/*.read?code=foo
    • getV2Permissions

      @Nonnull public Set<ca.cdr.api.security.SmartPermissions.SmartV2Permission> getV2Permissions()
    • hasV2Permission

      public boolean hasV2Permission(ca.cdr.api.security.SmartPermissions.SmartV2Permission read)
      Does the scope have the given V2 permission, or the equivalent from v1.
    • getFilter

      @Nullable public String getFilter()
      Get the (optional) filter from the scope. E.g. "code=foo" from patient/*.read?code=foo
    • hasFilter

      public boolean hasFilter()
    • isImpliedBy

      public boolean isImpliedBy(SmartClinicalScope theOtherScope)
      Is this scope implied by theOtherScope. We need to know if requested scopes are permitted by the registered allowed scopes. This isn't just simple string-set membership since the allowed scopes might be patient/*.read while the requested scope could be patient/Observation.read, or patient/Observation.r
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object theOther)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • hasSearch

      public boolean hasSearch()
    • compareTo

      public int compareTo(@Nonnull SmartClinicalScope o)
      Specified by:
      compareTo in interface Comparable<SmartClinicalScope>