ISecurityLabels.ValueStr

Syntax

ValueStr([Subject: ISecuritySubject = Null]): String;

Parameters

Subject. Optional parameter that determines a security subject (user, group). By default - a current user.

Description

The ValueStr property returns mask value for the security subject sent by input parameter in the string form.

Comments

The whole mask is divided into groups by 32 bits. This character string is a sequence of decimal numbers, each of them is a mask in a decimal mode that bits correspond with security subjects.

For the user the ValueStr value returns the value of the mask including all groups in which the user is included and for which the bit of the mask is associated.

This property is relevant if security labels are put in correspondence with more that 32 security subjects. If no mask bit corresponds with a security object- 0 returns.

Example

Executing the example requires a table dictionary with Tab_Dict identifier.

Sub UserProc;
Var
    MB: IMetabase;
    MDesc: IMetabaseObjectDescriptor;
    Group1, User1, User2: ISecuritySubject;
    SecDesc: ISecurityDescriptor;
    SecLab: ISecurityLabels;
    AttributeValue: IAccessAttributeValue;
Begin
    MB := MetabaseClass.Active;
    MDesc := MB.ItemById(
"Tab_Dict");
    
//Security subjects that will be added to the dictionary
    Group1 := MB.Security.ResolveName("Users");
    User1 := MB.Security.ResolveName(
"Name1");
    User2 := MB.Security.ResolveName(
"Name2");
    SecDesc := MDesc.SecurityDescriptor;
    SecDesc.Edit;
    SecLab := SecDesc.LabelSecurity;
    
//Setting new associations
    SecLab.BitCount := 35;
    SecLab.Mapping(
32) := Group1;
    SecLab.Mapping(
33) := User1;
    SecLab.Mapping(
34) := User2;
    SecDesc.Apply(
False);
    Debug.WriteLine(
"The value of the mask for subjects including the group which includes them);
    Debug.WriteLine(
"Group1 :" + SecLab.ValueStr(Group1));
    Debug.WriteLine(
"User1 :" + SecLab.ValueStr(User1));
    Debug.WriteLine(
"User2 :" + SecLab.ValueStr(User2));
    Debug.WriteLine(
"The value of the mask for the subjects without groups which include them");
    AttributeValue := 
New AccessAttributeValue.Create(SecLab.BitCount, 0);
    AttributeValue.Value(
32) := True;
    Debug.WriteLine(
"Group1 :" + AttributeValue.ToString);
    AttributeValue := 
New AccessAttributeValue.Create(SecLab.BitCount, 0);
    AttributeValue.Value(
33) := True;
    Debug.WriteLine(
"User1 :" + AttributeValue.ToString);
    AttributeValue := 
New AccessAttributeValue.Create(SecLab.BitCount, 0);
    AttributeValue.Value(
34) := True;
    Debug.WriteLine(
"User2 :" + AttributeValue.ToString);
End Sub UserProc;

After executing the example security labels are changed for a table dictionary. For the specified bits of the mask the specified security subjects created for the current repository will be associated. After that the formed values of the mask will be displayed in the development environment console.

See also:

ISecurityLabels