Value: Variant;
The Value property determines an attribute value.
This property is relevant when the custom attribute value is edited. The specified value should have the data type determined for the attribute. To determine multiple value of the attribute, specify value array in the Value property. The array should also have the type that is determined for the attribute.
To determine default attribute value, use the IABACAttribute.DefaultValue property.
Executing the example requires that an integer custom attribute with the WORKDAYS identifier is added for users.
Add links to the ABAC and Metabase system assemblies.
Sub UserProc;
Var
Insts: IABACAttributeInstances;
Inst: IABACAttributeInstance;
MB: IMetabase;
MS: IMetabaseSecurity;
User: IMetabaseUser;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Get license to be able to work with the security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
// Get attributes of the first user
User := MS.Users.Item(0);
Insts := User.Attributes;
// Find attribute with the WORKDAYS identifier
Inst := Insts.FindById("WORKDAYS");
// Check whether value of the found attribute is multiple
If Inst.IsArray = False Then
// Change attribute value if it is not multiple
Inst.Value := 20;
End If;
// Save changes in the security manager
MS.Apply;
// Check in license
Lic := Null;
End Sub UserProc;
After executing the example, value of the attribute with the specified identifier is changed for the specified user.
Executing the example requires that an integer custom attribute with the VALUES identifier is added for users. The TEST_USER user is created in the security manager.
Add links to the ABAC and Metabase system assemblies.
Sub UserProc;
Var
Insts: IABACAttributeInstances;
Inst: IABACAttributeInstance;
MB: IMetabase;
MS: IMetabaseSecurity;
User: IMetabaseUser;
AttrValues: Array Of Integer;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Get license to be able to work with the security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
// Get attributes of the specified user
User := MS.ResolveName("TEST_USER") As IMetabaseUser;
Insts := User.Attributes;
// Find attribute with the VALUES identifier
Inst := Insts.FindById("VALUES");
// Create an array with multiple values
AttrValues := New Integer[3];
AttrValues[0] := 1;
AttrValues[1] := 2;
AttrValues[2] := 3;
// Change attribute value
Inst.Value := AttrValues;
// Save changes in the security manager
MB.Security.Apply;
// Check in license
Lic := Null;
End Sub UserProc;
After executing the example, multiple value is set for the specified custom attribute.
See also: