public class RunAsUserCommand extends Object implements ServiceCommand
| Constructor and Description |
|---|
RunAsUserCommand(ConfluenceUser userToRunAs,
ServiceCommand delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
execute()
Execute the command.
|
Collection |
getValidationErrors()
Gets the list of errors that are preventing the command from being executed.
|
boolean |
isAuthorized()
Determine if the current user is authorized to execute this command.
|
boolean |
isValid()
Determine if the command is in a valid state to be executed.
|
public RunAsUserCommand(ConfluenceUser userToRunAs, ServiceCommand delegate)
public boolean isValid()
ServiceCommandServiceCommand.execute() is be expected to perform successfully (unless prevented by some system
error). If this method returns false, execute will fail with a
NotValidException.
This method should be called after checking ServiceCommand.isAuthorized(). If the current user is not
authorized to execute this command, this method must throw a NotAuthorizedException.
If this method returns false, then ServiceCommand.getValidationErrors() must return a non-empty list of
errors explaining why the command was not valid. If this method returns true, the collection returned by
getValidationErrors() must be empty.
isValid in interface ServiceCommandpublic Collection getValidationErrors()
ServiceCommandServiceCommand.isValid() will always return an empty collection.getValidationErrors in interface ServiceCommandValidationError objects describing why command validation failedpublic boolean isAuthorized()
ServiceCommandAuthenticatedUserThreadLocal.get().isAuthorized in interface ServiceCommandpublic void execute()
ServiceCommandexecute in interface ServiceCommandCopyright © 2003–2022 Atlassian. All rights reserved.