Class SmartClinicalScope

java.lang.Object
ca.cdr.api.security.SmartClinicalScope

public final class SmartClinicalScope extends Object
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
    • getPermissions

      @Nonnull public String getPermissions()
      Get the permissions. E.g. "read" from patient/Observation.read Can be "*"
    • isRead

      public boolean isRead()
      Do the permissions allow read.
      Returns:
      true for "read" or "*"
    • isWrite

      public boolean isWrite()
      Do the permissions allow write.
      Returns:
      true for "write" or "*"
    • 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()
    • computeNarrowedAuthority

      @Nonnull public Optional<GrantedAuthorityJson> computeNarrowedAuthority(GrantedAuthorityJson theGrantedAuthorityJson)
      Compute the intersection of the authority and this scope. E.g. patient/Observation.read should narrow FHIR_READ_ALL to FHIR_READ_ALL_OF_TYPE/Observation. patient/Observation.read will narrow FHIR_READ_ALL_OF_TYPE/Patient to empty.
      Parameters:
      theGrantedAuthorityJson - the users authority
      Returns:
      the authority narrowed by this scope if applicable
    • isImpliedBy

      public boolean isImpliedBy(SmartClinicalScope theOtherScope)
    • 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()