Package org.graylog.security
Class UserContext
java.lang.Object
org.graylog.security.UserContext
- All Implemented Interfaces:
HasUser
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionUserContext
(String userId, org.apache.shiro.subject.Subject subject, UserService userService) -
Method Summary
Modifier and TypeMethodDescriptiongetUser()
boolean
Checks if the user is permitted to do everythingprotected boolean
boolean
isPermitted
(String permission) boolean
isPermitted
(String permission, String id) boolean
isPermitted
(String permission, GRN target) static void
Build a temporary Shiro Subject and run the callable within that contextstatic <T> T
Build 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
-