Switching inheritance on and off for File system permissions

C

Captain Kirk

Hi Everyone
When a folder is created its file system
permissions are inherited automatically to its subfolders and its subfiles.
I want to switch the inheritance on and off through c# code. Following is
the small snippet of the code that I have written to do this. But it is not
working properly

ActiveDs.IADsAccessControlList obDacl = ( ActiveDs.IADsAccessControlList )

securitydescriptor.DiscretionaryAcl;

Allow = new AccessControlEntryClass();

//For recursive security settings

Allow.AceFlags = (int)ADS_ACEFLAG_ENUM.ADS_ACEFLAG_NO_PROPAGATE_INHERIT_ACE;

//ACE is allow type

Allow.AceType = 3;



Can anyone please help me?
 
W

Willy Denoyette [MVP]

Not sure what exactly you mean with:
But it is not
working properly
but I guess this is what you need to use....

Allow.AceFlags = (int)ADS_ACEFLAG_ENUM.ADS_ACEFLAG_INHERITED_ACE;

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top