Attribute: IABACAttribute;
Attribute: Prognoz.Platform.Interop.ABAC.IABACAttribute;
The Attribute property returns attribute properties for editing.
This property is relevant on editing existing attribute properties.
To determine attribute properties, use the IABACAttribute interface.
To execute the example, make sure that a custom attribute is added for users.
Add links to the ABAC, Metabase, Dal, ForeSystem (for the Fore.NET example) system assemblies.
Sub UserProc;
Var
Insts: IABACAttributeInstances;
Attr: IABACAttribute;
MB: IMetabase;
MS: IMetabaseSecurity;
Lic: Object;
i, Count: Integer;
Begin
MB := MetabaseClass.Active;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
// Change identifier of the last user's attribute
Insts := MS.Users.Item(0).Attributes;
Count := Insts.Count;
Attr := Insts.Item(Count-1).Attribute;
Attr.Id := "WORKDAYS";
// Display properties of user's custom attributes in the console
For i := 0 To Count-1 Do
If Insts.Item(i).Attribute.Predefined = False Then
Debug.WriteLine("Name: " + Insts.Item(i).Name(MB.CurrentLocale)); // name
Debug.WriteLine("Identifier: " + Insts.Item(i).Id); // identifier
Debug.WriteLine("Key: " + Insts.Item(i).Key.ToString); // key
Debug.WriteLine("Data type: " + Insts.Item(i).DataType.ToString); // data type
Debug.WriteLine("============================");
End If;
End For;
// Save changes in security manager
MB.Security.Apply;
// Check in license
Lic := Null;
End Sub UserProc;
Imports Prognoz.Platform.Interop.ABAC;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
Insts: IABACAttributeInstances;
Attr: IABACAttribute;
MB: IMetabase;
MS: IMetabaseSecurity;
Lic: Object;
i, Count: Integer;
Begin
MB := Params.Metabase;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
MS := MB.Security;
// Change identifier of the last users attribute
Insts := MS.Users.Item[0].Attributes;
Count := Insts.Count;
Attr := Insts.Item[Count-1].Attribute;
Attr.Id := "WORKDAYS";
// Display properties of user's custom attributes in the console
For i := 0 To Count-1 Do
If Insts.Item[i].Attribute.Predefined = False Then
System.Diagnostics.Debug.WriteLine("Name: " + Insts.Item[i].Name[MB.CurrentLocale]); // name
System.Diagnostics.Debug.WriteLine("Identifier: " + Insts.Item[i].Id); // identifier
System.Diagnostics.Debug.WriteLine("Key: " + Insts.Item[i].Key.ToString()); // key
System.Diagnostics.Debug.WriteLine("Data type: " + Insts.Item[i].DataType.ToString()); // data type
System.Diagnostics.Debug.WriteLine("============================");
End If;
End For;
// Save changes in security manager
MB.Security.Apply();
// Check in license
Lic := Null;
End Sub;
After executing the example the last attribute identifier is changed. The properties of custom attributes for users are displayed in the console:
Name: Custom attribute
Identifier: CUSTOM_ATTR
Key: 15
Data type: 1
============================
Name: Number of workdays
Identifier: WORKDAYS
Key: 16
Data type: 2
============================
See also: