MeVisLabToolboxReference
|
Authorization framework encapsulation. More...
#include <macAuthorization.h>
Public Types | |
enum | AuthorizationError { ErrAuthorizationUnknown = -1, ErrAuthorizationSuccess = 0, ErrAuthorizationCanceled = 1, ErrAuthorizationDenied = 2, ErrAuthorizationToolExecuteFailure = 3, ErrAuthorizationToolEnvironmentError = 4 } |
Authorization error codes. More... | |
Public Member Functions | |
Authorization () | |
C-tor. | |
~Authorization () | |
D-tor. | |
void | setPrompt (const std::string &prompt) |
Set prompt used when no prompt is provided with a function call (UTF8) | |
bool | executeWithPrivileges (const std::string &cmd, const std::list< std::string > &argv, const std::string &prompt=std::string(), AuthorizationError *error=NULL) |
execute cmd including arguments with privileges (UTF8) | |
const std::string & | getCommandOutput () const |
return a reference to the stdout output string of the command last executed |
Authorization framework encapsulation.
Definition at line 19 of file macAuthorization.h.
Authorization error codes.
Definition at line 24 of file macAuthorization.h.
macx::Authorization::Authorization | ( | ) |
C-tor.
macx::Authorization::~Authorization | ( | ) |
D-tor.
bool macx::Authorization::executeWithPrivileges | ( | const std::string & | cmd, |
const std::list< std::string > & | argv, | ||
const std::string & | prompt = std::string() , |
||
AuthorizationError * | error = NULL |
||
) |
execute cmd including arguments with privileges (UTF8)
calling the function multiple times will reuse an existing authorization reference. Hence, an instance of this class should be used to authorize calls that "belong together", in the sense that the user should consider them a single security event. If they are meant to be separate, so that a user could meaningfully approve one but decline another, you should use separate instances.
const std::string& macx::Authorization::getCommandOutput | ( | ) | const |
return a reference to the stdout output string of the command last executed
void macx::Authorization::setPrompt | ( | const std::string & | prompt | ) |
Set prompt used when no prompt is provided with a function call (UTF8)
The prompt string is used in the authentication dialog box.