Package org.graylog.security
Class UserContext
java.lang.Object
org.graylog.security.UserContext
- All Implemented Interfaces:
HasUser
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionUserContext(String userId, org.apache.shiro.subject.Subject subject, UserService userService) -
Method Summary
Modifier and TypeMethodDescriptiongetUser()booleanChecks if the user is permitted to do everythingprotected booleanbooleanisPermitted(String permission) booleanisPermitted(String permission, String id) booleanisPermitted(String permission, GRN target) static voidBuild a temporary Shiro Subject and run the callable within that contextstatic <T> TBuild a temporary Shiro Subject and run the callable within that context
-
Constructor Details
-
Method Details
-
runAs
Build a temporary Shiro Subject and run the callable within that context- Type Parameters:
T- The return type of the callable.- Parameters:
username- The username of the subjectcallable- The callable to be executed- Returns:
- whatever the callable returns.
-
runAs
Build a temporary Shiro Subject and run the callable within that context- Parameters:
username- The username of the subjectrunnable- The runnable to be executed
-
getUserId
-
getUser
-
isOwner
-
hasAllPermission
public boolean hasAllPermission()Checks if the user is permitted to do everything- Returns:
- The check result
-
isPermitted
-
isPermitted
-
isPermitted
-