Elevated Privileges
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 9389
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Elevated Privileges
Yeah, yeah, yeah: planning to plant viruses all over the place . . .
Nope: sorry to disappoint any would-be nasty pieces of work who might be lurking round these parts.
HOWVER, I would like to know whether it is possible to ask an end-user through a standalone for admin privileges to, say, store a preferences file somewhere a bit more discreet than in a file in the end-user's home folder . . .
Nope: sorry to disappoint any would-be nasty pieces of work who might be lurking round these parts.
HOWVER, I would like to know whether it is possible to ask an end-user through a standalone for admin privileges to, say, store a preferences file somewhere a bit more discreet than in a file in the end-user's home folder . . .
Re: Elevated Privileges
Why not use specialFolderPath("support")?richmond62 wrote: ↑Sat Dec 02, 2023 5:15 pmI would like to know whether it is possible to ask an end-user through a standalone for admin privileges to, say, store a preferences file somewhere a bit more discreet than in a file in the end-user's home folder . . .
On Windows this points to the current user's application-specific data ("AppData") folder and on MacOS the current user's application-specific data folder. Neither of these require escalated privileges or permission, while being more discreet because users tend not to look in these locations...
-
- Livecode Opensource Backer
- Posts: 9389
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Elevated Privileges
Now, that is a thought: Thank you.
HOWEVER; let us just suppose that I wish to issue a terminal command from inwith a standalone.
HOWEVER; let us just suppose that I wish to issue a terminal command from inwith a standalone.
Re: Elevated Privileges
I never tried it, because I have never made anything for other users that needed special permissions, but in the Standalone Builder settings for Windows there's a drop-down you can choose for the level of privilege the standalone should expect to require. If you set it to highest available then it might require elevated privileges to run, or once run and permission granted, it may stick and remember that it was installed with rights to do what you want. Of course there may be all sorts of different outcomes, especially on different OS and patching levels. I might get a chance to try it myself this weekend but I don't know.
-
- Livecode Opensource Backer
- Posts: 9389
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Elevated Privileges
This is the sort of thing I had in mind (and for Linux, Windows, and Macintosh):
-
-
Re: Elevated Privileges
You could use a DOT as the first character of your prefs file, that will make the file invisible for users but not for LC!
-> .el_preffo
-> .el_preffo
Re: Elevated Privileges
Escalated privileges are required only if you're changing something in sensitive areas or something that may affect other users.
This is of course very different from your initial question of 'save a preference file discreetly'.
I'm also not sure what terminal command you have in mind that would be an issue?
For most common uses associated with user-level actions I found that setting the privilege set to that of the user (ie no escalation required) was more than enough for all my uses. On Windows you do this by setting the UAC execution level to 'same as invoker' in the standalone settings. You do have other options like 'highest available' or 'require administrator' which will bring up the UAC dialog you show above, if you definitely want to show this - again I'm not sure why you'd do this.
On MacOS the process is different if you want the user to grant access - and many have posted on the process in the forums.
Which then brings us to the age-old question: what is it you are actually trying to achieve?
This is of course very different from your initial question of 'save a preference file discreetly'.
I'm also not sure what terminal command you have in mind that would be an issue?
For most common uses associated with user-level actions I found that setting the privilege set to that of the user (ie no escalation required) was more than enough for all my uses. On Windows you do this by setting the UAC execution level to 'same as invoker' in the standalone settings. You do have other options like 'highest available' or 'require administrator' which will bring up the UAC dialog you show above, if you definitely want to show this - again I'm not sure why you'd do this.
On MacOS the process is different if you want the user to grant access - and many have posted on the process in the forums.
Which then brings us to the age-old question: what is it you are actually trying to achieve?
-
- Livecode Opensource Backer
- Posts: 9389
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Elevated Privileges
I am asking a question for someone who is too 'shy' to ask it over here themselves.what is it you are actually trying to achieve?
Re: Elevated Privileges
OK - so what exactly is this 'shy' person trying to achieve?richmond62 wrote: ↑Sat Dec 02, 2023 6:23 pmI am asking a question for someone who is too 'shy' to ask it over here themselves.what is it you are actually trying to achieve?
-
- Livecode Opensource Backer
- Posts: 9389
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Elevated Privileges
Ha, ha, ha: well at the risk of offending that person:
Here's a strange question, but what's the best way for a standalone to attain administrator privileges on Windows / sudo privileges on MacOS and Linux? I ask, as I'd like to remove the terminal part of my updater, and having it apply the updates seamlessly without having the user jump through that terminal copy-and-paste malarkey
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Elevated Privileges
Would "open elevated process" do what's needed?
https://livecode.com/resources/api-old/ ... en_process
https://livecode.com/resources/api-old/ ... en_process
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Elevated Privileges
Well I'm not sure about the logic here.richmond62 wrote: ↑Sat Dec 02, 2023 6:28 pmHa, ha, ha: well at the risk of offending that person:
Here's a strange question, but what's the best way for a standalone to attain administrator privileges on Windows / sudo privileges on MacOS and Linux? I ask, as I'd like to remove the terminal part of my updater, and having it apply the updates seamlessly without having the user jump through that terminal copy-and-paste malarkey
Why would you need terminal copy-and-paste malarkey [sic] to apply updates 'seamlessly'? And why would this require admin access?
Why not just use the built-in file manipulation commands to remove existing files and update?
-
- Livecode Opensource Backer
- Posts: 9389
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Elevated Privileges
Nor am I to be honest as this is only relevant if the end-user installs some software to a root user account.Well I'm not sure about the logic here.