Platforms to show: All Mac Windows Linux Cross-Platform
Back to AuthorizationMBS class.
AuthorizationMBS.Authorize(rights as AuthorizationItemSetMBS, flags as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
See also:
AuthorizationMBS.Authorize(rights as AuthorizationItemSetMBS, flags as Integer, byref outrights as AuthorizationItemSetMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
The Authorizated property is set if this function was successfull.
Lasterror is set.
outrights is on return a list of the rights which are authorized.
Extends the rights of the class.
When the kAuthorizationFlagInteractionAllowed flag is set, user interaction will happen when required. Failing to set this flag will result in this call failing with a errAuthorizationInteractionNotAllowed status when interaction is required.
Setting the kAuthorizationFlagExtendRights flag will extend the currently available rights.
Setting the kAuthorizationFlagPartialRights flag will cause this call to succeed if only some of the requested rights are being granted by the system. Unless this flag is set this API will fail if not all the requested rights could be obtained.
Setting the kAuthorizationFlagDestroyRights flag will prevent any additional rights obtained during this call from being preserved after returning from this API.
Setting the kAuthorizationFlagPreAuthorize flag will pre authorize the requested rights so that at a later time -- by calling GetExternalForm() follow by NewAuthorizationFromExternalForm() -- the obtained rights can be used in a different process. Rights that can't be preauthorized will be treated as if they were authorized for the sake of returning an error (in other words if all rights are either authorized or could not be preauthorized this call will still succeed).
The rights which could not be preauthorized are not currently authorized and may fail to authorize when a later call to Authorize() is made, unless the kAuthorizationFlagExtendRights and kAuthorizationFlagInteractionAllowed flags are set. Even then they might still fail if the user does not supply the correct credentials.
The reason for passing in this flag is to provide correct audit trail information and to avoid unnecessary user interaction.
Error codes:
errAuthorizationSuccess | 0 | No error. |
errAuthorizationInvalidRef | -60002 | The authorization parameter is invalid. |
errAuthorizationInvalidSet | -60001 | The rights parameter is invalid. |
errAuthorizationInvalidPointer | -60004 | The authorizedRights parameter is invalid. |
See also:
AuthorizationMBS.Available as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 2.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns false on any error.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 2.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Strings made with the ExternalForm function will become invalid!
There is no need to call this method except you want to free all resources used by this object now without waiting for Xojo to do it for you.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
AuthorizationMBS.EOFStream as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
AuthorizationMBS.Execute(toolpath as string, parameters() as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 2.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
You may make some small shell script which you launch in background. This script can change some other utility to run as root (Setuid), so you can do admin stuff using the normal shell class.
Lasterror is set.
Currently this function is not available to RB versions before 3.5.
Note that the parameters parameter is an array of strings and not just one.
toolpath should use an absolute path in unix style.
Lasterror is set to -1 if the path is empty or you are not using Mac OS X.
See also:
AuthorizationMBS.Execute(toolpath as string, parameters() as string, openstream as boolean)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Currently this function is not available to RB versions before 3.5.
Note that the parameters parameter is an array of strings and not just one.
toolpath should use an absolute path in unix style.
Lasterror is set to -1 if the path is empty or you are not using Mac OS X.
See also:
AuthorizationMBS.ExternalForm as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 2.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
This external representation depends on your process. You can't save it to disk or keep it longer than the Authorization object exists.
If the Authorization object is destroyed, your application quits or the authorization times out, this external form becomes invalid.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
AuthorizationMBS.Info as AuthorizationItemSetMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns nil on any error.
AuthorizationMBS.MakeStreamAsyncron
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 6.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Some examples using this method:
AuthorizationMBS.NewAuthorization(rights as AuthorizationItemSetMBS, flags as Integer) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 2.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Lasterror is set. Returns true if successfull.
Create a new autorization object which can be used in other authorization calls.
When the kAuthorizationFlagInteractionAllowed flag is set, user interaction will happen when required. Failing to set this flag will result in this call failing with a errAuthorizationInteractionNotAllowed status in the lasterror property when interaction is required.
Setting the kAuthorizationFlagExtendRights flag will extend the currently available rights. If this flag is set the class will grant all the rights requested when errAuthorizationSuccess is returned in the lasterror property. If this flag is not set the operation will almost certainly succeed, but no attempt will be made to make the requested rights availible.
Call the Info function to figure out which of the requested rights are granted by the system.
Setting the kAuthorizationFlagPartialRights flag will cause this call to succeed if only some of the requested rights are being granted by the system. Unless this flag is set this API will fail if not all the requested rights could be obtained.
Setting the kAuthorizationFlagPreAuthorize flag will pre authorize the requested rights so that at a later time -- by calling GetExternalForm() follow by NewAuthorizationFromExternalForm() in a different object -- the obtained rights can be used in a different process. Rights that can't be preauthorized will be treated as if they were authorized for the sake of returning an error (in other words if all rights are either authorized or could not be preauthorized this call will still succeed).
The rights which could not be preauthorized are not currently authorized and may fail to authorize when a later call to Authorize() is made, unless the kAuthorizationFlagExtendRights and kAuthorizationFlagInteractionAllowed flags are set. Even then they might still fail if the user does not supply the correct credentials.
The reason for passing in this flag is to provide correct audit trail information and to avoid unnecessary user interaction.
rights (input/optional):
An AuthorizationItemSet containing rights for which authorization is being requested. If nil are specified the class will authorize nothing at all.
flags (input) options specified using the different constants from this class.
Error codes:
errAuthorizationSuccess | 0 | Authorization or all requested rights succeeded. |
errAuthorizationDenied | -60005 | The authorization for one or more of the requested rights was denied. |
errAuthorizationCanceled | -60006 | The authorization was cancled by the user. |
errAuthorizationInteractionNotAllowed | -60007 | The authorization was denied since no interaction with the user was allowed. |
AuthorizationMBS.NewAuthorizationFromExternalForm(s as string) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 2.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
You can store an authorization in a string for use in a subprocess. For example your application can ask the user for Root rights and you pass this string to a launched terminal application which will use it without having it's own interface.
Lasterror is set. Returns true if successfull.
AuthorizationMBS.ReadStream(count as Integer) as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Tries to read count bytes.
Lasterror is set.
The returned string will be as long as the number of strings read.
Lasterror is set to -1 by the plugin if the stream is not open, or you are not using Mac OS X or the memory allocation failed.
Some examples using this method:
AuthorizationMBS.SimpleAuthorize
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
This is the function from MBS Plugin 3.0.
AuthorizationMBS.SimpleNewAuthorization as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
This is the function from MBS Plugin 3.0.
Some examples using this method:
AuthorizationMBS.Wait as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns the Process ID or -1 on an error.
Lasterror is set.
AuthorizationMBS.WriteStream(s as string) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Authorization | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
The items on this page are in the following plugins: MBS MacCF Plugin.