MeVisLabToolboxReference
macx::Authorization Class Reference

Authorization framework encapsulation. More...

#include <macAuthorization.h>

List of all members.

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

Detailed Description

Authorization framework encapsulation.

Definition at line 19 of file macAuthorization.h.


Member Enumeration Documentation

Authorization error codes.

Enumerator:
ErrAuthorizationUnknown 

An unknown failure occured.

ErrAuthorizationSuccess 

The authorization succeeded.

ErrAuthorizationCanceled 

The authorization was cancelled by the user.

ErrAuthorizationDenied 

The authorization was denied.

ErrAuthorizationToolExecuteFailure 

The specified program could not be executed.

ErrAuthorizationToolEnvironmentError 

Privileged helper tool is invalid or an invalid status was returned during execution of the privileged helper tool.

Definition at line 24 of file macAuthorization.h.


Constructor & Destructor Documentation

macx::Authorization::Authorization ( )

C-tor.

macx::Authorization::~Authorization ( )

D-tor.


Member Function Documentation

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.


The documentation for this class was generated from the following file: