Classes: IMetabaseSecurityClassesAttributes;
The Classes property returns object type parameters.
This property is relevant on adding a new attribute for a particular object type.
Object types are determined using the IMetabaseSecurityClassesAttributes.Add method by two ways:
As the MetabaseObjectClass enumeration, for example:
Classes.Add(MetabaseObjectClass.KE_CLASS_STDDIM);
As a value, for example:
Classes.Add(1025).
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;
Attrs: IMetabaseSecurityObjectsAttributes;
ClassAttrs: IMetabaseSecurityClassAttributes;
Begin
MB := MetabaseClass.Active;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
// Add an attribute for the Table Dictionary object type
Attrs := MS.Policy.ObjectsAttributes;
ClassAttrs := Attrs.Classes.Add(1025);
ABACAttribute := ClassAttrs.Attributes.Add;
ABACAttribute.Name(MB.CurrentLocale) := "Object type";
ABACAttribute.Id := "Dictionary";
ABACAttribute.Description(MB.CurrentLocale) := "For table dictionaries";
ABACAttribute.DefaultValue := 20;
ABACAttribute.DataType := DbDataType.Integer;
// Add an attribute for object classes
Attrs := MetabaseClass.Active.Security.Policy.ObjectsAttributes;
ABACAttribute := Attrs.Global.Add;
ABACAttribute.Name(MB.CurrentLocale) := "Object classes";
ABACAttribute.Id := "Object";
ABACAttribute.Description(MB.CurrentLocale) := "For object classes";
ABACAttribute.DefaultValue := 15;
ABACAttribute.DataType := DbDataType.Integer;
// 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;
Attrs: IMetabaseSecurityObjectsAttributes;
ClassAttrs: IMetabaseSecurityClassAttributes;
Begin
MB := Params.Metabase;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
MS := MB.Security;
// Add an attribute for the Table Dictionary object type
Attrs := MS.Policy.ObjectsAttributes;
ClassAttrs := Attrs.Classes.Add(1025);
ABACAttribute := ClassAttrs.Attributes.Add();
ABACAttribute.Name[MB.CurrentLocale] := "Object type";
ABACAttribute.Id := "Dictionary";
ABACAttribute.Description[MB.CurrentLocale] := "For table dictionaries";
ABACAttribute.DefaultValue := 20;
ABACAttribute.DataType := DbDataType.ddtInteger;
// Add an attribute for object classes
Attrs := MS.Policy.ObjectsAttributes;
ABACAttribute := Attrs.Global.Add();
ABACAttribute.Name[MB.CurrentLocale] := "Object classes";
ABACAttribute.Id := "Object";
ABACAttribute.Description[MB.CurrentLocale] := "For object classes";
ABACAttribute.DefaultValue := 15;
ABACAttribute.DataType := DbDataType.ddtInteger;
// Save changes in security manager
MS.Apply();
// Check in license
Lic := Null;
End Sub;
After executing the example the attributes for object class and the particular object type that is Table Dictionary are added in the security manager.
See also: