public class UserContext extends Object
Modifier and Type | Class and Description |
---|---|
static class |
UserContext.Factory |
Constructor and Description |
---|
UserContext(String userId,
org.apache.shiro.subject.Subject subject,
UserService userService) |
Modifier and Type | Method and Description |
---|---|
User |
getUser() |
String |
getUserId() |
boolean |
hasAllPermission()
Checks if the user is permitted to do everything
|
protected boolean |
isOwner(GRN entity) |
boolean |
isPermitted(String permission) |
boolean |
isPermitted(String permission,
GRN target) |
boolean |
isPermitted(String permission,
String id) |
static <T> T |
runAs(String username,
Callable<T> callable)
Build a temporary Shiro Subject and run the callable within that context
|
static void |
runAs(String username,
Runnable runnable)
Build a temporary Shiro Subject and run the callable within that context
|
public UserContext(String userId, org.apache.shiro.subject.Subject subject, UserService userService)
public static <T> T runAs(String username, Callable<T> callable)
T
- The return type of the callable.username
- The username of the subjectcallable
- The callable to be executedpublic static void runAs(String username, Runnable runnable)
username
- The username of the subjectrunnable
- The runnable to be executedpublic String getUserId()
public User getUser()
protected boolean isOwner(GRN entity)
public boolean hasAllPermission()
public boolean isPermitted(String permission)
Copyright © 2012–2021 Graylog, Inc.. All rights reserved.