IABACAttribute.Predefined

Syntax

Predefined: Boolean;

Predefined: System.Boolean;

Description

The Predefined property returns True if an attribute is system.

Comments

Attributes are divided into system and custom, they are used on creating an objective and additional conditions of access check.

NOTE. Properties of system attributes cannot be changed.

Example

To execute the example, make sure that there is a custom attribute for users.

Add links to the ABAC, Metabase system assemblies.

Sub UserProc;
Var
    ABACAttribute: IABACAttribute;
    ABACAttributes: IABACAttributes;
    MB: IMetabase;
    MS: IMetabaseSecurity;
    Str: String;
Begin
    MB := MetabaseClass.Active;

    MS := MB.Security;
    
// Check users attributes
    ABACAttributes := MS.Users.Attributes;
    ABACAttribute := ABACAttributes.Item(
6);
    
If ABACAttribute.Predefined = True Then
        Str:= 
"system";
        
Else Str:= "custom";
    
End If;
    Debug.WriteLine(
"The " + "" + ABACAttribute.Name(MB.CurrentLocale) + " attribute" + " - " + Str);
    ABACAttribute := ABACAttributes.Item(
7);
    
If ABACAttribute.Predefined = True Then
        Str:= 
"system";
        
Else Str:= "custom";
    
End If;
    Debug.WriteLine(
"The " + "" + ABACAttribute.Name(MB.CurrentLocale) + " attribute" + " - " + Str);
End Sub UserProc;

Imports Prognoz.Platform.Interop.ABAC;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    ABACAttribute: IABACAttribute;
    ABACAttributes: IABACAttributes;
    MB: IMetabase;
    MS: IMetabaseSecurity;
    Str: String;
Begin
    MB := Params.Metabase;
    MS := MB.Security;
    
// Check users attributes
    ABACAttributes := MS.Users.Attributes;
    ABACAttribute := ABACAttributes.Item[
6];
    
If ABACAttribute.Predefined = True Then
        Str:= 
"system";
        
Else Str:= "custom";
    
End If;
    System.Diagnostics.Debug.WriteLine(
"The " + "" + ABACAttribute.Name[MB.CurrentLocale] + " attribute" + " - " + Str);
    ABACAttribute := ABACAttributes.Item[
7];
    
If ABACAttribute.Predefined = True Then
        Str:= 
"system";
        
Else Str:= "custom";
    
End If;
    System.Diagnostics.Debug.WriteLine(
"The " + "" + ABACAttribute.Name[MB.CurrentLocale] + " attribute" + " - " + Str);
End Sub;

After executing the example the console displays:

The Administrator attribute - system

The ATTR16 attribute - custom

See also:

IABACAttribute