AccessAttributeValue.Create

Syntax

Create(BitCount: Integer; Value: Variant);

Parameters

BitCount - number of access subjects, for which permissions may be determined.

Value - access mask. Mask value is set with 4-byte binary number. Each character of the binary number determines a permission on a relevant action of a defined security subject:

Bit number corresponds to subjects sequence in a list on the Access Subjects tab if numbering starts 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 converted to a decimal form 118

A mask may be set in a number and a character mode. A binary number must be converted to a decimal form to assign it in a number mode. To set it in a character mode the whole mask is divided into groups on 32 bits, then each group is converted to a decimal number. Spaces must be added to each received decimal number so that there must be 12 characters. A full string is made from received substrings. Consider the following example. Mask value in a binary mode (34 bits): 1010101010101010101010101010101010. To set it in a character mode, divide a string into groups: 10101010101010101010101010101010 and 10. Convert each group to a decimal form: 2863311530 and 2. Then add groups with spaces: "2863311530  " and "2           ". A string value necessary to transfer to the Value parameter: "2863311530  2           ".

Description

The Create method creates an access attribute.

Example

Executing the example requires that the schema contains an MDM repository with the MDM identifier and an MDM dictionary with the Dict_1 identifier. 4 users or 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 the example access permissions on reading the first element, all its child elements 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. Setting mask in a number mode is shown in the example for IAccessElement.Apply.

See also:

AccessAttributeValue