BitCount: Integer;
The BitCount property returns the number of security subjects, which may have permissions determined.
Executing the example requires that the repository contains an MDM dictionary with the DICT_1 identifier.
Sub UserProc;
Var
MB: IMetabase;
MDesc: IMetabaseObjectDescriptor;
AOS: IAccessObjectSecurity;
Iterator: IAccessElementsIterator;
Element: IAccessElement;
AttributeValue: IAccessAttributeValue;
i: Integer;
Begin
MB := MetabaseClass.Active;
MDesc := MB.ItemById("DICT_1");
AOS := MDesc.GetSecurity;
Iterator := AOS.GetElements;
Iterator.Next;
Element := Iterator.Current;
AttributeValue := Element.AttributeAccess(AccessElementAttributes.Read);
Debug.WriteLine("Number of security subjects: " + AttributeValue.BitCount.ToString);
For i := 0 To AttributeValue.BitCount Do
Debug.WriteLine(AttributeValue.Value(i));
End For;
End Sub UserProc;
After executing the example the number of possible access subjects and also a right value on reading the first element of MDM dictionary for each subject are displayed in the console window.
See also: