PermissionException

Hoping someone can help and that my question is not too dumb..Using Xojo on a mac.

UseTrial(TA_SYSTEM) raises new PermissionException.

If I understand, it is because the user does not have sufficient privileges and that the privileges should be somehow given during the installation process of the application? (if that is right, how can I test it meantime?)I was not counting on using an installer, just a DMG and drag as installation.. Am i obliged to have some kind of installation to somehow get the privileges working right for operation. Hope this makes sense?

Also do you have detailed documentation for the mac and xojo. I don't see anything like what apparently exists for Windows..

thanks very much

theo

If I understand, it is because the user does not have sufficient privileges and that the privileges should be somehow given during the installation process of the application? (if that is right, how can I test it meantime?)

Yes, correct. You can use TA_USER instead of TA_SYSTEM if you can't get or don't want to get the user permission.

Am i obliged to have some kind of installation to somehow get the privileges working right for operation. Hope this makes sense?

Only if you want to store the "trial data" and "activation data" (with CheckAndSavePKey) on a system level rather than a user level. It's entirely up to you.

Also do you have detailed documentation for the mac and xojo. I don't see anything like what apparently exists for Windows..

Yes, see: Using TurboActivate with Xojo (Real Studio / Real Basic).

thanks very much for that (quick) reply..

I would like if possible to have the activation work across all accounts. (At least that seems fair to the person paying for the program.) So am going to have figure out how to so all this as TA_SYSTEM.Is there a way I can do this during debug in order to test TA_SYSTEM? How do I appear with the right privileges to Xojo?

Or is it something that you use TA_USER during debug and switch to TA_SYSTEM for the build with an installer that gives the right privileges?

the big question is how do I get these privileges during installation?I guess I have to go the installer route and not a drag the app from a dmg file?

I found this in the forum: call the CheckAndSavePKey(0, TA_SYSTEM); function in your installer that you'll know will be elevated. Then you can make all subsequent calls from non-elevated apps.

am on on the right track?

thanks again..

theo

How do I appear with the right privileges to Xojo?

It has nothing to do with Xojo. It's all about the system. Namely, you need "root" permission the first time you call UseTrial( )and CheckAndSavePKey() with TA_SYSTEM.

You can do this by calling your app using sudo (e.g. sudo yourapp). This will "elevate" your app, and thus the UseTrial() and CheckAndSavePKey() functions will succeed.

the big question is how do I get these privileges during installation?

The installer should prompt for username / password. That gives it permission to make "system" changes.

I guess I have to go the installer route and not a drag the app from a dmg file?

It depends on what you want to do. You want system-wide trials / activations, then use an installer. Otherwise you can just use TA_USER and drag an app from a DMG.

I found this in the forum: call the CheckAndSavePKey(0, TA_SYSTEM); function in your installer that you'll know will be elevated. Then you can make all subsequent calls from non-elevated apps.

Yes.

OK. great.. all understood... thanks v much for your time..t

follow up... Is it possible to have the TA_SYSTEM used during debugging in Xojo? I have tried all kinds of ways to elevate to root during debug for example using Dim sh as new Shell/sh.Execute "sudo ""my app""" and a hundred other concepts but always get: "You don't have sufficient privileges to install a trial as administrator". Can I only test the TA_SYSTEM from an actual mac installer installing the software elevated to root access? (Hope my understanding of all this now is reasonable...) thanks..

when using TA_SYSTEM, isn't the app activated for every account on a computer? I have activated on one account using TA_SYSTEM and it is deactivated on another... is this normal? thanks..

when using TA_SYSTEM, isn't the app activated for every account on a computer?

Yes.

I have activated on one account using TA_SYSTEM and it is deactivated on another... is this normal?

No, it sounds like you called CheckAndSavePKey() with TA_USER.

Call CheckAndSavePKey() with TA_SYSTEM and make sure the call actually succeeds.

Is it possible to have the TA_SYSTEM used during debugging in Xojo?

Yes, call "sudo yourapp" from terminal and make sure UseTrial() and CheckAndSavePKey() are using TA_SYSTEM at least once. Then all subsequent calls to UseTrial() and CheckAndSavePKey() will be able to use TA_SYSTEM without having to "elevate".

I have tried all kinds of ways to elevate to root during debug for example using Dim sh as new Shell/sh.Execute "sudo ""my app""" and a hundred other concepts but always get: "You don't have sufficient privileges to install a trial as administrator".

I sounds like you're not doing it right. You should do it something like this:

sudo /Location/To/You/MyAppName.app/Contents/MacOS/MyApp

ouch.. you were right, I wasn't doing it right.. all is now moving in the right direction.. thanks for your help

again regarding the permissions issue:am making an application for OSX, with TA_SYSTEM so all users can use it.Am trying to figure out how on first run it launches sudo "app" with root access so that the TA can be installed but on subsequent launches, it does not ... does this make sense? thanks

I'm not sure what you're asking.

From your elevated (a.k.a. "sudo") installer just call UseTrial(TA_SYSTEM) and CheckAndSavePKey(0, TA_SYSTEM) (or call a helper app that makes these calls). Then all subsequent calls using TA_SYSTEM will succeed (regardless of whether your app is elevated or not).

Sorry, am not asking very clearly probably because I don't quite understand the principle behind how it all exactly works.. my question now would be from your answer: Do I have to call both? Am assuming a trial will begin if I call UseTrial(TA_SYSTEM) and would prefer it begin only when app is installed and later launched and user clicks 'Start Trial'... I think I can call CheckAndSavePKey without anything happening I don't want to happen..

Yeah, you have to call both (or else the one you don't call will fail if the calling app doesn't have "sudo" permissions).

Regarding the "Start trial" button, I'd say ditch it. Just offer user trial extensions if they run out of trial days. Of example, when the trial days expires, just popup a dialog that say "Your trial has expired. If you need more time testing AppX, then shoot us an email at support@example.com and we'll send you a trial extension.". Or something like that.

thanks. What if I activated the trial using TA_USER and Activation using TA_SYSTEM? could I use a combination ?

by the way am having a hard time getting the installer am building to work. I sudo an invisible little helper app that runs CheckAndSavePKey(0, TA_SYSTEM) as I read on the forums.. (it seems to work fine if put in an activation key, but I can't seem to set it up as NULL as you suggested. It always fails unless I use a key. On xojo strings are apparently never null and maybe that is the reason.. I certainly can't use the 0 as in the suggestion as it is not even a string, and anything else I put in as null in this environment, nil, "", does not work. the CheckAndSave function fails every time and without an exception I can identify.

thanks again

thanks. What if I activated the trial using TA_USER and Activation using TA_SYSTEM? could I use a combination ?

Yes, the trial and activation systems are completely separate.

On xojo strings are apparently never null and maybe that is the reason.. I certainly can't use the 0 as in the suggestion as it is not even a string, and anything else I put in as null in this environment, nil, "", does not work. the CheckAndSave function fails every time and without an exception I can identify.

Ok, you're right, Xojo likes to "simplify" things. You'll have to copy the "Declare Functions" lines from CheckAndSavePKey and change "CString" to "Ptr". Like this:

Declare Function CheckAndSavePKey Lib TALibrary (ByVal productKey As Ptr, ByVal flags As UInt32) As Int32


Dim ret As Int32 = CheckAndSavePKey(nil, TA_SYSTEM)

An error code is expected in the "ret" value, so long is the error isn't TA_E_PERMISSION. That is, if the return code is anything other than TA_E_PERMISSION then that means CheckAndSavePKey has successfully set up everything for subsequent calls.

Cool. I was trying to modify that code but did not change the productKey to Ptr but to CString which did not work.. So then what string do I send to the function in CheckAndSavePKey("?????", TA_SYSTEM) ?

Ia gave you both lines: the declaration and the usage:

Declare Function CheckAndSavePKey Lib TALibrary (ByVal productKey As Ptr, ByVal flags As UInt32) As Int32


Dim ret As Int32 = CheckAndSavePKey(nil, TA_SYSTEM)

Use "nil", like I show.

the call CheckAndSavePKey has two parameters: productKey As string, flags As UInt32. I can't send anything but a string for productkey when I call the function. Or should I change productkey to Ptr? if not CheckAndSavePKey(?, TA_SYSTEM) then raise new TurboActivateException ...

I guess I am missing something?

I was saying redeclare the function call to CheckAndSavePKey for your dummy app (the simple app your call from your installer).

You don't eve need to do that. Just use a dummy string ("hello world").

OK.. got it... thanks.. (it works)

A followup.. Does it sound like a workable idea therefore that I can use the CheckAndSavePKey null test in my main application on first launch, and every launch, to check if CheckAndSavePKey has been run in the past as root and successfully installed TurborActivate? I can then offer a trial instead of automatically starting one on first launch on a new system...

Am going to start the trial on first run... you are right, it really only works easily that way as there is no function to determine if on trial without starting a trial... Is something like this possible in the future?

Is something like this possible in the future?

We don't plan on it. That's what trial extensions are for.

When a customer installs an app the presumption is that they will begin using it soon after.