Re: Finding user permissions
Linux is easy, just call getuid() and/or geteuid(). "0" means the user is root (or that the application is suid root in the second case).
Re: Finding user permissions
I know Windows stores the user id in an environment variable, but you shouldn't depend on it for security reasons since it can be overwritten by any application.
Re: Finding user permissions
Hey wysota,
Thanks for that info on linux. What if the software is installed in a user's home directory, so they have privileges to run it, but aren't root. Any idea what to do then?
David
Re: Finding user permissions
What do you need that information for? If the software is executing (as you want to do something from within the program), the user obviously has rights to execute it... For arbitrary files there is QFileInfo::isExecutable().
Re: Finding user permissions
I don't need it in linux and solaris anymore. What i wanted was to know whether i had permission to execute a given file from within my program, depending on who i was logged in as, and where I was. On Windows I always needed to be Admin user.
All is good now :)
Re: Finding user permissions
Couldn't you just try and execute the file and if you get an error you obviously didn't have permission?