Those interested in the
why can have a look
here[
^].
For now, I wonder
how to do the following:
During installation with administrative permissions, my software creates a directory within "Documents and Settings\All Users\Documents". Users shall save their projects there.
Normally, users are allowed to create their own files there but not to alter files created by another user. I want to allow users to change all files regardless of creator. This is what I derived from
stackoverflow.com[
^]
System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(dirName);
DirectorySecurity dSecurity = dInfo.GetAccessControl();
dSecurity.AddAccessRule(
new FileSystemAccessRule(
new System.Security.Principal.NTAccount("UserGroupGoesHere"),
FileSystemRights.DeleteSubdirectoriesAndFiles,
AccessControlType.Allow
)
);
dInfo.SetAccessControl(dSecurity);
Maybe, I'll have to repeat permission adaption on every file create for the newly created file. But still the question stands: What is "UserGroupGoesHere" to substitute for? It shall represent all normal users, not excluding power users.
How do I get the name of the "users" user group on any given windows pc?