Class SubjectContext
- java.lang.Object
-
- org.openmetadata.service.security.policyevaluator.SubjectContext
-
public class SubjectContext extends Object
Subject context used for Access Control Policies
-
-
Field Summary
Fields Modifier and Type Field Description static StringTEAM_FIELDSprotected Useruser
-
Constructor Summary
Constructors Modifier Constructor Description protectedSubjectContext(User user)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<org.openmetadata.service.security.policyevaluator.SubjectContext.PolicyContext>getPolicies(EntityReference resourceOwner)static List<EntityReference>getRolesForTeams(List<EntityReference> teams)static SubjectContextgetSubjectContext(String userName)List<EntityReference>getTeams()booleanhasAnyRole(String roles)Returns true if the user has any of the roles (either direct or inherited roles)static booleanhasRole(User user, String role)Return true if the given user has any roles the list of rolesbooleanisAdmin()booleanisBot()static booleanisInTeam(String parentTeam, EntityReference team)Return true if the team is part of the hierarchy of parentTeambooleanisOwner(EntityReference owner)booleanisTeamAsset(String parentTeam, EntityReference owner)Returns true if the given resource owner is under the team hierarchy of parentTeambooleanisUserUnderTeam(String parentTeam)Returns true if the user of this SubjectContext is under the team hierarchy of parentTeam
-
-
-
Field Detail
-
TEAM_FIELDS
public static final String TEAM_FIELDS
- See Also:
- Constant Field Values
-
user
protected final User user
-
-
Constructor Detail
-
SubjectContext
protected SubjectContext(User user)
-
-
Method Detail
-
getSubjectContext
public static SubjectContext getSubjectContext(String userName)
-
isAdmin
public boolean isAdmin()
-
isBot
public boolean isBot()
-
isOwner
public boolean isOwner(EntityReference owner)
-
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
-
getRolesForTeams
public static List<EntityReference> getRolesForTeams(List<EntityReference> teams)
-
getPolicies
public Iterator<org.openmetadata.service.security.policyevaluator.SubjectContext.PolicyContext> getPolicies(EntityReference resourceOwner)
-
getTeams
public List<EntityReference> getTeams()
-
hasAnyRole
public boolean hasAnyRole(String roles)
Returns true if the user has any of the roles (either direct or inherited roles)
-
-