PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WDx] Getting admin privileges to create folders
[WDx] Getting admin privileges to create folders
Iniciado por guest, 17,jul. 2015 14:44 - 7 respuestas
Publicado el 17,julio 2015 - 14:44
Hi,

my customer wants me to implement the following functionality:

The users have no admin rights and can't create folders. For each customer the program has to automatically create some folders:

drive:\customers\customer Müller

If the user creates an order for the customer Müller then the program has to create additional folders:

drive:\customers\customer Müller\orders 2015\order 4711\

Is there a way to get the admin rights from within my program to create the folders?

Any help is welcome.

Thanks in advance and greetings
Markus
Publicado el 17,julio 2015 - 15:23
Hi Markus,

isn't that enough to change the manifest of your program so that it HAS admin privilege when it is installed?

Best regards
Publicado el 17,julio 2015 - 16:26
Hi Markus,

There are many ways to do that, even by programming (look at WDSETUP, it does just that). But I think in your case this is not required.

Another very simple solution is simply to set the folder's permissions to "Everyone" so that normal users can read/write/create/delete folders. And then there is nothing to change in your program. You can also give special access : can create, but cannot delete, for example.

Best regards,
Alexandre Leclerc
Publicado el 17,julio 2015 - 16:36
Hi Fabrice,

the program runs on a citrix-server and it has no rights.

Therefore i need a way to get admin rights for creating the folders on a fileserver. After creating the folders i use the tool setacl.exe to grant rights to specific usergroups. E.g. the user are not allowed to delete or create new folders, they only can put new files into the folders and open the files, they cant open the folder etc.

If i connect to the citrix with a user with admin rights all works fine, but the normal users have no admin rights and are not allowed to do operations on the fileserver.

I don't think i can handle this with a manifest or am i wrong?
Publicado el 17,julio 2015 - 16:39
Hi Alexandre,

the user should be able to open the window explorer from within the program to put new files into the folders or delete the files.
Publicado el 17,julio 2015 - 17:36
Hi Markus,

If the program (or user) has no rights, who will give it the rights to create the folder? A user with administrative rights will have to come and provide his credentials every time.

If you use a manifest file, admin rights will be prompted everytime for the application to run as an administrator and the application itself will be able to do everything.

If you do not want the administrator to come everytime to give permission to create a folder, another solution is to make a small service worker (a small application that runs as a service, and who will have admin rights) to create the folders. Then you non-admin application can ask the service to create the folder for you and set the proper rights.

Best regards,
Alexandre Leclerc
Publicado el 17,julio 2015 - 18:19
Some low tech possibilities:

In your app you can write one bat to create the folder you need and you can run it using ExeRemoteRun using a user with administrative rights
http://doc.windev.com/en-US/…

I never used it this way (running on the same machine) just give it a try, i use it a lot to run programs in another machine in my DMZ to bypass some firewall problems.


If you have one share in the fileserver you can use NetworkConnect to assing one driver using a user with administrative rights, create the folder and NetworkDisconnect to remove the drive letter.
http://doc.windev.com/en-US/…
Publicado el 18,julio 2015 - 00:29
Hi,

what kind of files are stored in this specific folder?
Why do you not store the files in the users folder, example
\users\%username%\appdata\.... or \users\%username%\myfiles or or ....
This is according to the rules of M$, that each user shold store his personal files in his personal folders .....

Or you can store the data in the database, using an binary datatype?

My opinion is not to break the security rules of the operating system by granting admin privileges to an application



Stefan.