BitCount: Integer;
The BitCount property returns the number of security subjects, which may have permissions determined.
Executing the example requires that the schema contains an MDM repository with the MDM identifier and an MDM dictionary with the Dict_1 identifier.
Sub UserProc;
Var
MB : IMetabase;
Object : IMetabaseObjectDescriptor;
AOS : IAccessObjectSecurity;
Iterator : IAccessElementsIterator;
element : IAccessElement;
AttributeValue : IAccessAttributeValue;
i : Integer;
Begin
MB := MetabaseClass.Active;
Object := MB.ItemByIdNamespace("Dict_1", MB.ItemById("RDS").Key);
AOS := Object.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 Button4OnClick;
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: