FileSecurity - Allow full access for everyone to a folder

delphi package - easy access to security apis

FileSecurity - Allow full access for everyone to a folder

Postby fpj » Mon Feb 05, 2018 10:28 am

Hello Madshi! How are you? I am an old (registered) user and a fan of you and your solutions.

Please give me a little help. I am using madSecurity FileSecurity to allow full access for "everyone" to a specific folder:

Code: Select all
with FileSecurity('c:\test').DAcl do
begin
  Clear;
  SetFileAccess(Everyone, true);
  Flush;
end;


Am I doing the right way? I see some people using "Deallocate" instead of "SetFileAccess(Everyone, true)", what is the difference?

Thank you!

Fabio
fpj
 
Posts: 5
Joined: Tue May 26, 2015 5:52 pm

Re: FileSecurity - Allow full access for everyone to a folde

Postby madshi » Mon Feb 05, 2018 10:54 am

You don't necessarily need to use "Flush", it should be done automatically, but only when the FileSecurity interface runs out of scope. The "Flush" shouldn't harm, though, so you can keep it there.

A "NULL" ACL by default gives access to Everyone. So simply doing Deallocate will have the same effect. Actually, it's different: Deallocate will truely assign a NULL ACL, which Windows interprets as full access for Everyone. Your code instead assigns a valid ACL which has the user "Everyone" in it. Different things to achieve the same effective OS behaviour.
madshi
Site Admin
 
Posts: 9774
Joined: Sun Mar 21, 2004 5:25 pm

Re: FileSecurity - Allow full access for everyone to a folde

Postby fpj » Mon Feb 05, 2018 10:59 am

Ok, understood! Thank you again! Success!
fpj
 
Posts: 5
Joined: Tue May 26, 2015 5:52 pm


Return to madSecurity

Who is online

Users browsing this forum: No registered users and 2 guests

cron