views:

44

answers:

1

Hello, I have been working with System.DirectoryServices for a while in a project involving Active Directory. I am curious on the implementation of the UserAccountControl property to control the attributes of a particular account. If I wanted to implement settings in my own applications using a combination of bytes to determine the state of x or y setting, how would I go about doing this in C#? Say that I would like to implement a useraccountcontrol property on my own class and I want to use a combination of bytes to determine which permissions the account should have.

Here is the way it is modified in Active Directory: http://support.microsoft.com/kb/305144

and here is the place with the object definition: http://msdn.microsoft.com/en-us/library/ms680832%28VS.85%29.aspx

Edit:

Say that I have a User class of my own and I want to implement a property similar to the way UserAccountControl is implemented in Active Directory. Let's say I want to have a set of four bytes storing the settings.

I want to use the last byte to determine the account status, 0 = Account Inactive 1= Account Active 2=Account Expired 4=Some Other Status 8=Yet Another Status.

Then the next byte to the left I want to contain the account type: 16=Admin Account, 32=Regular Account, 64=Guest Account, 128 = Other Account.

Then use the next byte to the left to set some other setting so that 256 = something, 512 = something else, 1024 = something else, etc.

I would like to combine this to use bitwise combinations to set the account properties. I have the idea in my head, but I am not sure how to implement it, or if it even makes sense what I am trying to do.

Edit: After receiving the answer and doing some more digging I found this link that talks more about setting Flags: http://msdn.microsoft.com/en-us/library/ms229062.aspx