public interface ImpersonationService
Modifier and Type | Method and Description |
---|---|
boolean |
canDoPrivilegedAction(PluginId id)
Can the plugin do a privleged action
|
boolean |
canImpersonate(PluginId id,
java.lang.String userName)
Are we allowed to impersonate this user?
|
<T,E extends java.lang.Throwable> |
doAsDefaultUser(PluginId id,
Operation<T,E> operation)
Deprecated.
use
doAsUser(com.atlassian.crucible.spi.PluginId, String, Operation) for impersonating a user
or doPrivilegedAction(com.atlassian.crucible.spi.PluginId, Operation) for a privileged mode |
<T,E extends java.lang.Throwable> |
doAsUser(PluginId id,
java.lang.String userName,
Operation<T,E> operation)
Execute an Operation as a particular user.
|
<T,E extends java.lang.Throwable> |
doPrivilegedAction(PluginId id,
Operation<T,E> operation)
Execute an Operation in a privileged mode.
|
UserData |
getCurrentUser(PluginId id)
Get the current user, if any.
|
java.lang.String |
getCurrentUserName(PluginId id)
Get the current username -- can be done more cheaply than getting the user
|
UserData |
getDefaultUser(PluginId id)
Get the name of the default user configured for this plugin, if any
|
<T,E extends java.lang.Throwable> T doAsUser(PluginId id, java.lang.String userName, Operation<T,E> operation) throws E extends java.lang.Throwable
T
- the Type returned by the operation.E
- the type of Exception thrown by the Operation.id
- the PluginId of the calling plugin.userName
- a String naming the user to impersonate.operation
- the Operation to perform.E
- when thrown by Operation.perform()NotPermittedException
- when the given plugin is not allowed to impersonate the given user.E extends java.lang.Throwable
@Deprecated <T,E extends java.lang.Throwable> T doAsDefaultUser(PluginId id, Operation<T,E> operation) throws E extends java.lang.Throwable
doAsUser(com.atlassian.crucible.spi.PluginId, String, Operation)
for impersonating a user
or doPrivilegedAction(com.atlassian.crucible.spi.PluginId, Operation)
for a privileged modeT
- the Type returned by the operation.E
- the type of Exception thrown by the Operation.id
- the PluginId of the calling plugin.operation
- the Operation to perform.E
- if the operation throws an exception while executing.E extends java.lang.Throwable
<T,E extends java.lang.Throwable> T doPrivilegedAction(PluginId id, Operation<T,E> operation) throws E extends java.lang.Throwable
T
- the Type returned by the operation.E
- the type of Exception thrown by the Operation.id
- the PluginId of the calling plugin.operation
- the Operation to perform.E
- if the operation throws an exception while executing.E extends java.lang.Throwable
boolean canImpersonate(PluginId id, java.lang.String userName)
id
- the PluginId of the calling plugin.userName
- a String naming the user we wish to impersonate.true
if we are allowed to impersonate this user, false
otherwiseboolean canDoPrivilegedAction(PluginId id)
id
- the PluginId of the calling plugintrue
if the plugin can to a privileged action, false
otherwiseUserData getDefaultUser(PluginId id)
id
- the PluginId of the calling plugin.UserData getCurrentUser(PluginId id)
id
- the PluginId of the calling plugin.java.lang.String getCurrentUserName(PluginId id)