Platform SDK: Active Directory, ADSI, and Directory Services |
To add an extended right to Active Directory, you create a controlAccessRight object in the Extended-Rights container of the Configuration partition. Visual Basic and C++ sample code at the end of this topic show how to do it. To use the extended right, you must do a few more things depending on whether the extended right is for a special operation or a property set.
If you are defining an extended right for a property set, you must use the rightsGUID of the controlAccessRight object to identify the properties in the set. Every property is defined by an attributeSchema object in the Active Directory schema. The attributeSecurityGUID property of an attributeSchema object identifies the property set, if any, that the property belongs to. Note that the attributeSecurityGUID property is single-valued and stores the GUID in binary format (octet string syntax).
If you are defining an extended right to control access to a special operation, it is up to your application to perform the access check when a user tries to perform the operation. The following steps show how to do this:
When you create a controlAccessRight object, you must set the following attributes to make the object a legal extended right that is recognized by Active Directory and the Windows NT®/Windows® 2000 security system:
In the list, each object class is identified by the schemaIDGUID of its classSchema object. The GUIDs are stored as strings of the form produced by the StringFromGUID2 function in the COM library—but without the starting and terminating curly braces ({ }). For example, the following GUID is the schemaIDGUID for the computer class:
bf967a86-0de6-11d0-a285-00aa003049e2
Note that the schemaIDGUID property of a classSchema object is stored as a binary GUID using the octet string syntax. To convert this octet string format to the string format used in the appliesTo property, use the StringFromGUID2 function and remove the curly braces from the returned string.
To get the schemaIDGUID property of one of the predefined object classes, such as user or computer, see the class reference page in the Active Directory Schema Reference in the Active Directory Reference. For sample code that retrieves a schemaIDGUID from a classSchema object, see Reading attributeSchema and classSchema Objects.
If you are defining a new property set, you use the rightsGUID of the controlAccessRight object to identify the properties in the set. Every property is defined by an attributeSchema object in the Active Directory schema. The attributeSecurityGUID property of an attributeSchema object identifies the property set, if any, that the property belongs to. Note that the attributeSecurityGUID property is single-valued and stores the GUID in binary format (octet string syntax).