MeVisLab Toolbox Reference
macos::internal::Authorization Class Reference

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 (const std::string &prompt=std::string())
 C-tor (Optionally set a prompt used when no prompt is provided with a function call) More...
 
 ~Authorization ()
 D-tor. More...
 
void setPrompt (const std::string &prompt)
 Set prompt used when no prompt is provided with a function call (UTF8) More...
 
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) More...
 
const std::string & getCommandOutput () const
 return a reference to the stdout output string of the command last executed More...
 

Detailed Description

Authorization framework encapsulation.

Definition at line 29 of file macAuthorization.h.

Member Enumeration Documentation

◆ AuthorizationError

Authorization error codes.

Enumerator
ErrAuthorizationUnknown 

An unknown failure occurred.

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 34 of file macAuthorization.h.

Constructor & Destructor Documentation

◆ Authorization()

macos::internal::Authorization::Authorization ( const std::string &  prompt = std::string())

C-tor (Optionally set a prompt used when no prompt is provided with a function call)

◆ ~Authorization()

macos::internal::Authorization::~Authorization ( )

D-tor.

Member Function Documentation

◆ executeWithPrivileges()

bool macos::internal::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.

◆ getCommandOutput()

const std::string& macos::internal::Authorization::getCommandOutput ( ) const

return a reference to the stdout output string of the command last executed

◆ setPrompt()

void macos::internal::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: