File Permission

delphi package - easy access to security apis
Post Reply
arcanjo_junior
Posts: 46
Joined: Sun Oct 09, 2005 1:06 am

File Permission

Post by arcanjo_junior »

Hi, I would like know if is possible change a file permission using madSecurity.
My problem is : I have one file and I cannot change the file using a limited user. If I use madSecurity I can set permission for read/write this file ? If yes, You can send a simple example ?

Thanks.
<@rCANJ0>
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You can do that, but you need to have enough access rights to the file to change security settings. You can try e.g. "FileSecurity(filePath).DAcl.SetFileAccess(CurrentUser, true)" to give the current user full access rights. If that doesn't work, you can try "FileSecurity(filePath).Owner := CurrentUser" and then the first code again.
Post Reply