Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

AuthorizationMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Authorization MBS MacCF Plugin 2.8 Yes No No Yes, macOS only No
Function: A class to run a root shell on Mac OS X.
Notes:
Some notes from Ilija Injac on this usage of this class:

The main problem for the execution of the perl script was, that perl is not able to find the required perl-modules at execution with the option "-U" (this switch is set for security reasons).
It was also neccessary to include the perl-modules from inside the perl script wich has to be executed.
Inside the Realbasic code i created a AuthorizationItemMBS with the value "/usr/bin/perl":
...
i = new AuthorizationItemMBS
i.name = a.kAuthorizationItemRightExecute
i.value = "/usr/bin/perl"
...
Actually it is the same source as in Christians "Authorization 1" example within the "test1" function. And it works !

Feedback, Comments & Corrections

Error Codes

Constant Value Description
errAuthorizationCanceled -60006 The authorization was cancelled by the user.
errAuthorizationDenied -60005 The authorization was denied.
errAuthorizationExternalizeNotAllowed -60009 The authorization is not allowed to be converted to an external format.
errAuthorizationInteractionNotAllowed -60007 The authorization was denied since no user interaction was possible.
errAuthorizationInternal -60008 Unable to obtain authorization for this operation.
errAuthorizationInternalizeNotAllowed -60010 The authorization is not allowed to be created from an external format.
errAuthorizationInvalidFlags -60011 The provided option flag(s) are invalid for this authorization operation.
errAuthorizationInvalidPointer -60004 The returned authorization is invalid.
errAuthorizationInvalidRef -60002 The authorization reference is invalid.
errAuthorizationInvalidSet -60001 The authorization rights are invalid.
errAuthorizationInvalidTag -60003 The authorization tag is invalid.
errAuthorizationSuccess 0 No error.
errAuthorizationToolEnvironmentError -60032 An invalid status was returned during execution of a privileged tool.
errAuthorizationToolExecuteFailure -60031 The specified program could not be executed.

Flag values

Constant Value Description
kAuthorizationFlagCanNotPreAuthorize 1 Indicates the Security Server could not preauthorize the right.
kAuthorizationFlagDefaults 0 If no bits are set, none of the following features are available.
kAuthorizationFlagDestroyRights 8 If the bit specified by this mask is set, the Security Server revokes authorization from the process as well as from any other process that is sharing the authorization. If the bit specified by this mask is not set, the Security Server revokes authorization from the process but not from other processes that share the authorization.
kAuthorizationFlagExtendRights 2 If the bit specified by this mask is set, the Security Server attempts to grant the rights requested. Once the Security Server denies one right, it ignores the remaining requested rights.
kAuthorizationFlagInteractionAllowed 1 If the bit specified by this mask is set, you permit the Security Server to interact with the user when necessary.
kAuthorizationFlagPartialRights 4 If the bit specified by this mask and the kAuthorizationFlagExtendRights mask are set, the Security Server grants or denies rights on an individual basis and all rights are checked.
kAuthorizationFlagPreAuthorize 16 If the bit specified by this mask is set, the Security Server preauthorizes the rights requested.

This class has no sub classes.

Some methods using this class:

Some examples which use this class:


The items on this page are in the following plugins: MBS MacCF Plugin.


AuthorizationItemSetMBS   -   AvahiBrowserMBS




Links
MBS Xojo blog