Page 1 of 1

FileSecurity - Allow full access for everyone to a folder

PostPosted: Mon Feb 05, 2018 10:28 am
by fpj
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

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

PostPosted: Mon Feb 05, 2018 10:54 am
by madshi
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.

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

PostPosted: Mon Feb 05, 2018 10:59 am
by fpj
Ok, understood! Thank you again! Success!