Attributes: IABACAttributes;
Attributes: Prognoz.Platform.Interop.ABAC.IABACAttributes;
The Attributes property returns the collection of attributes of groups of users.
The property is read-only.
To execute the example, add links to the ABAC, Metabase, Dal, ForeSystem (for Fore.NET example) system assemblies.
Sub UserProc;
Var
Attr: IABACAttribute;
Attrs: IABACAttributes;
MB: IMetabase;
MS: IMetabaseSecurity;
Lic: Object;
Begin
MB := MetabaseClass.Active;
MS := MB.Security;
// Check out license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
// Add attribute for users
Attrs := MS.Users.Attributes;
Attr := Attrs.Add;
Attr.Name(MB.CurrentLocale) := "New attribute"; // attribute name
Attr.Id := "ATTR_USER"; // attribute identifier
Attr.DataType := DbDataType.String; // attribute data type
Attr.DefaultValue := "User name"; // default name
// Add an attribute for groups of users
Attrs := MS.Groups.Attributes;
Attr := Attrs.Add;
Attr.Name(MB.CurrentLocale) := "New attribute"; // attribute name
Attr.Id := "ATTR_GROUP"; // attribute identifier
Attr.DataType := DbDataType.Integer; // attribute data type
Attr.DefaultValue := 20; // default name
// 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
Attr: IABACAttribute;
Attrs: IABACAttributes;
MB: IMetabase;
MS: IMetabaseSecurity;
Lic: Object;
Begin
MB := Params.Metabase;
MS := MB.Security;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
// Add attribute for users
Attrs := MS.Users.Attributes;
Attr := Attrs.Add();
Attr.Name[MB.CurrentLocale] := "New attribute"; // attribute name
Attr.Id := "ATTR_USER"; // attribute identifier
Attr.DataType := DbDataType.ddtString; // attribute data type
Attr.DefaultValue := "User name"; // default name
// Add an attribute for groups of users
Attrs := MS.Groups.Attributes;
Attr := Attrs.Add();
Attr.Name[MB.CurrentLocale] := "New attribute"; // attribute name
Attr.Id := "ATTR_GROUP"; // attribute identifier
Attr.DataType := DbDataType.ddtInteger; // attribute data type
Attr.DefaultValue := 20; // default name
// Save changes in security manager
MS.Apply();
// Check in license
Lic := Null;
End Sub;
After executing the example, attributes with specified properties are set for users and groups of users.
In the security manager the added attributes are contained in the Attributes window.
See also: