, but the question now is, after each batch adding one, delete the original users, such as the original user 1, there are 2 users, users of 3, 4 the add user, the user may, after the user 1, user 2, and 3 to delete user. Users only 4, 5, user permissions, only the original users and permissions down a user (not inherited), how to add users and permissions only
For (int I=0; I & lt; TxtUsers. Lines. Length; I++)//read from the inside txtbox users, each row of a
{
String [] line=txtUsers. Lines;
User=line [I];
Fswrite=new FileSystemAccessRule (user, FileSystemRights. Modify, InheritanceFlags ContainerInherit | InheritanceFlags. ObjectInherit, PropagationFlags. None, AccessControlType. Allow); ;//define the read and write access
Dirsec. AddAccessRule (fswrite);
}
Dirinfo. SetAccessControl (dirsec);
CodePudding user response:
FileSystemRights specific I didn't try, you can at least get the permission first, then add what you want to add, can tryCodePudding user response:
I found that if manually delete folder inheritance, use this tool to set the permissions inheritance is back, now very confused, don't know how to achieve. Adjusted inheritanceFlags enum value, reduces the files and folders permissions cannot achieve the desired effect, ace to answer