Create(BitCount: Integer; Value: Variant);
BitCount - number of access subjects for which permissions may be determined;
Value - access mask. Mask value is assigned with 4-byte binary number. Each character of a binary number determines a permission on a relevant action of a defined security subject:
0 - action is forbidden.
1 - action is allowed.
Bit number corresponds subjects sequence in a list on the Access Subjects tab if numbering begins with zero. Numbering is from right to left.
Mask value | ... 1 1 1 0 1 1 0 |
Subjects sequence in a list | ... 7 6 5 4 3 2 1 |
Mask value performed in a decimal form | 118 |
Mask may be assigned in a number and a character mode. A binary number must be performed in a decimal form to assign it in a number mode. To assign it in a character mode the whole mask is divided into groups on 32 bits then each group is performed in a decimal number. Spaces must be added to each received decimal number so that there must be 12 characters. Full string is made from received substrings. Let's analyze the following example. Mask value in a binary mode (34 bits): 1010101010101010101010101010101010. To assign it in a character mode it is necessary to divide a string into groups: 10101010101010101010101010101010 and 10. It is necessary to perform each group in a decimal mode: 2863311530 and 2. Then let's add groups with spaces: "2863311530 " and "2 ". A string value necessary to transmit to the parameter Value: "2863311530 2 ".
The Create method creates access attribute.
Executing the example requires that the scheme contains an MDM repository with the MDM identifier and an MDM dictionary with the Dict_1 identifier. 4 users/groups must exist in a list of access subjects for MDM dictionary.
Sub UserProc;
Var
MB : IMetabase;
Object : IMetabaseObjectDescriptor;
AOS : IAccessObjectSecurity;
Iterator : IAccessElementsIterator;
level : integer;
element : IAccessElement;
AttributeValue : IAccessAttributeValue;
Begin
MB := MetabaseClass.Active;
Object := MB.ItemByIdNamespace("Dict_1", MB.ItemById("RDS").Key);
AOS := Object.GetSecurity;
Iterator := AOS.GetElements;
Level := Iterator.Next;
element := Iterator.Current;
element := element.Edit;
AttributeValue := New AccessAttributeValue.Create(32,"12 "); // mask value assigned in a string mode
element.AttributeAccess(AccessElementAttributes.Read) := AttributeValue;
element.Apply(AccessElementApplyOptions.ByHierarhy Or AccessElementApplyOptions.ByLevel);
End Sub UserProc;
After executing this example access permissions on reading the first element, all its children and elements located on the same level with the first are changed. There is no access to these elements for the first two security subjects.Mask assignment in a number mode is shown in the example for IAccessElement.Apply.
See also: