BitCount: Integer;
TheBitCount property determines number of security subjects for which bits in access mask can be compared. Default property value is 32. Maximum number is 2048.
Executing the example requires a table dictionary with the Dim_1 identifier. At least five repositories are created in current repository.
Sub UserProc;
Var
MB: IMetabase;
MDesc: IMetabaseObjectDescriptor;
Users: IMetabaseUsers;
SecDesc: ISecurityDescriptor;
SecLab: ISecurityLabels;
i: Integer;
Begin
MB := MetabaseClass.Active;
MDesc := MB.ItemById("Dim_1");
Users := MB.Security.Users;
SecDesc := MDesc.SecurityDescriptor;
SecDesc.Edit;
SecLab := SecDesc.LabelSecurity;
For i := 0 To SecLab.BitCount - 1 Do
If SecLab.Mapping(i) <> Null Then
SecLab.Mapping(i) := Null;
End If;
End For;
Debug.WriteLine(MB.Security.Users.Count);
Debug.WriteLine(MB.Security.Groups.Count);
SecLab.BitCount := 97;
SecLab.Mapping(0) := Users.Item(0);
SecLab.Mapping(16) := Users.Item(1);
SecLab.Mapping(32) := Users.Item(2);
SecLab.Mapping(64) := Users.Item(3);
SecLab.Mapping(96) := Users.Item(4);
SecDesc.Apply(False);
For i := 0 To MB.Security.Users.Count - 1 Do
Debug.WriteLine(SecLab.ValueStr(Users.Item(i)));
End For;
End Sub UserProc;
After executing the example security labels are changed for a table dictionary. First five users created for current repository are compared with specified mask bits. Then mask values for all repository users are displayed into development environment console.
See also: