About AuthorizationMBS plugin

Hello @Christian_Schmitz
2 important things for me :
1/ Which parameter passed to the “Execute” command when there is no parameter? (the case of the “sudo purge” command)
I did this, is it ok?

Dim a As AuthorizationMBS
p = "/usr/sbin/purge"
s(0)="" //<--- Param Ok ???

a.Execute(p, s, true)

2/ Can the Terminal command “sudo periodic daily weekly monthly” be executed in one go?
Doesn’t seem to work (but work in Terminal), while daily, weekly, monthly alone seem to work

p = "/usr/sbin/periodic"
s(0) ="daily weekly monthly"

a.Execute(p, s, true)

Thanks very much

  1. the array of parameters can be empty, so no s(0) entry.
    dim s(-1) as string
  2. I would expect those words be each their own parameter
redim s(2)
s(0) = "daily"
s(1) = "weekly"
s(2) = "monthly"

Thank you very much, that made me. help well. One last thing for me and the most important : is it possible to display the AuthorizationMBS dialog box only once and memorize the SUDO password, so as not to ask for it every time? and if so, how to do it?
thanks again

Usually you would use permission to setup your helper to run as root with setuid bit.

Or register a launch agent to run as root.

This is a security risk and verboten.

You can only do a LaunchAgent as root with an installer AFAIK.

Not tried it myself, but you should be able to retain an authorization and reuse it in the same app life cycle.

Keeping the authorisation is possible. You just can’t save the password at all and you have to redo the authorisation between restarts.

Thanks @Beatrix_Willius
Yes, of course. I’m very interested in my app. But how to do it ?

I have a self-written installer where I use the old AuthorizationMBS. There you can use KeepRights:

'do Authorization
if theAuthorisation = nil then 
  theAuthorisation = new AuthorizationMBS
  theAuthorisation.KeepRights = true
  if not theAuthorisation.SimpleNewAuthorization then Return kErrorAuthorization
end if

At the next stage I check if theAuthorisation is nil again.