Class SubjectContext


  • public class SubjectContext
    extends Object
    Subject context used for Access Control Policies
    • Constructor Detail

      • SubjectContext

        protected SubjectContext​(User user)
    • Method Detail

      • isAdmin

        public boolean isAdmin()
      • isBot

        public boolean isBot()
      • isUserUnderTeam

        public boolean isUserUnderTeam​(String parentTeam)
        Returns true if the user of this SubjectContext is under the team hierarchy of parentTeam
      • isTeamAsset

        public boolean isTeamAsset​(String parentTeam,
                                   EntityReference owner)
        Returns true if the given resource owner is under the team hierarchy of parentTeam
      • isInTeam

        public static boolean isInTeam​(String parentTeam,
                                       EntityReference team)
        Return true if the team is part of the hierarchy of parentTeam
      • getPolicies

        public Iterator<org.openmetadata.service.security.policyevaluator.SubjectContext.PolicyContext> getPolicies​(EntityReference resourceOwner)
      • hasAnyRole

        public boolean hasAnyRole​(String roles)
        Returns true if the user has any of the roles (either direct or inherited roles)
      • hasRole

        public static boolean hasRole​(User user,
                                      String role)
        Return true if the given user has any roles the list of roles