permissions - C# Folder ACL's not applying -
i have started learning c# project @ work write updated user creation tool replace our old vbscript tool. far have completed active directory side of having issues folder acl's when creating profile folder.
i have made function remove folder acl's , start scratch function add acl's folder not seem work. here function:
public void createfolderacl(string folderpath, string account, filesystemrights rights, accesscontroltype controltype) { try { directorysecurity fs = directory.getaccesscontrol(folderpath); authorizationrulecollection rules = fs.getaccessrules(true, true, typeof(system.security.principal.ntaccount)); fs.addaccessrule(new filesystemaccessrule(@"domain\" + account, rights, controltype)); directory.setaccesscontrol(folderpath, fs); } catch(exception e) { console.writeline(e); } }
when pipe in
createfolderacl(userdata["profilepath"] + ".v2", "domain admins", filesystemrights.fullcontrol, accesscontroltype.allow);
it creates entry in folder no permissions set (see screenshot below) , not set of other permissions try apply alongside domain admins.
http://i.stack.imgur.com/iul1i.png
i new , first real program have hit snag , can't figure out going on.
the specific error is: system.security.principal.identitynotmappedexception: or identity references not translated.
sounds not addaccessrule. have at: set file access rule similar
Comments
Post a Comment