Attributes: IABACAttributeInstances;
The Attributes property returns the collection of values of system and custom security subject attributes.
Executing the example requires that an integer attribute with the ACCESS identifier and the VALUES string attribute is added for users in the security manager.
Add links to the ABAC, Metabase system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
MbSec: IMetabaseSecurity;
User: IMetabaseUser;
Attrs: IABACAttributeInstances;
Attr: IABACAttributeInstance;
AttrValues: Array Of String;
Begin
Mb := MetabaseClass.Active;
MbSec := Mb.Security;
// Get repository administrator attributes
User := MbSec.Users.Administrator;
Attrs := User.Attributes;
// Find attribute with the ACCESS identifier
Attr := Attrs.FindById("ACCESS");
Attr.Value := 100;
// Find attribute with the VALUES identifier
Attr := Attrs.FindById("VALUES");
// Create an array with a set of values
AttrValues := New String[3];
AttrValues[0] := "A";
AttrValues[1] := "B";
AttrValues[2] := "C";
// Change attribute value
Attr.Value := AttrValues;
// Save changes in the security manager
MB.Security.Apply;
End Sub UserProc;
After executing the example, values of the specified custom attributes are set for the repository administrator.
See also: