Name(Locale: LocaleCodeID): String;
Name[Prognoz.Platform.Interop.ForeSystem.LocaleCodeID]: System.String;
Locale. Name language.
The Name property determines an attribute name.
This property is relevant when a new attribute is added for users, groups of users, object classes, particular object types.
To execute the example, add links to the ABAC, Metabase, Dal, ForeSystem system assemblies (for the Fore.NET example).
Sub UserProc;
Var
ABACAttribute: IABACAttribute;
ABACAttributes: IABACAttributes;
MB: IMetabase;
MS: IMetabaseSecurity;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Get license to be able to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
// Add an attribute for users
ABACAttributes := MS.Users.Attributes;
ABACAttribute := ABACAttributes.Add;
ABACAttribute.Name(MB.CurrentLocale) := "Users";
ABACAttribute.Id := "WorkDays";
ABACAttribute.Description(MB.CurrentLocale) := "Number of workdays";
ABACAttribute.DefaultValue := 20;
ABACAttribute.DataType := DbDataType.Integer;
// Display key of new attribute in the console
Debug.WriteLine("Key of new attribute: " + ABACAttribute.Key.ToString);
// Save changes in security manager
MS.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
ABACAttribute: IABACAttribute;
ABACAttributes: IABACAttributes;
MB: IMetabase;
MS: IMetabaseSecurity;
Lic: Object;
Begin
MB := Params.Metabase;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
MS := MB.Security;
// Add an attribute for users
ABACAttributes := MS.Users.Attributes;
ABACAttribute := ABACAttributes.Add();
ABACAttribute.Name[MB.CurrentLocale] := "Users";
ABACAttribute.Id := "WorkDays";
ABACAttribute.Description[MB.CurrentLocale] := "Number of workdays";
ABACAttribute.DefaultValue := 20;
ABACAttribute.DataType := DbDataType.ddtInteger;
// Display key of new attribute in the console
System.Diagnostics.Debug.WriteLine("Key of new attribute: " + ABACAttribute.Key.ToString());
// Save changes in security manager
MS.Apply();
// Check in license
Lic := Null;
End Sub;
After executing the example the attribute is added for users in the security manager:
The key of the new attribute is displayed in the console:
New attribute key: 17
See also: