IRubricatorFactor.GetSubjectEffectiveRights

Syntax

GetSubjectEffectiveRights(Subject: ISecuritySubject): Integer;

GetSubjectEffectiveRights(Prognoz.Platform.Interop.Metabase.ISecuritySubject): System.Int32;

Parameters

Subject. Security subject, which effective permissions must be obtained.

Description

The GetSubjectEffectiveRights method returns effective permissions of the specified user for the factor.

Comments

Effective permissions include all the operations, which are explicitly allowed for the user. The value that is returned by this method is represented by an access mask. Mask value is an 8-bit byte binary number reduced to decimal form. To check mask value, it is required to use values of the MetabaseObjectPredefinedRights  enumerable type in combination with CubeSpecificRights. To parse mask value, implement the custom function that enables the user to compare separate mask bits to appropriate enumeration values. Examples of work with access mask are given in theWorking with Access Mask section. When permissions for the factor are distributed, the Read and Write operations are used.

Example

Executing the example requires that repository contains time series database with the OBJ_RUBRICATOR identifier where segments are identified and the fact metadictionary table contains 3 in the Facts column.

To execute the example, add links to the Metabase, Cubes, Rds (for Fore.NET example) system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    RubInst: IRubricatorInstance;
    Rub: IRubricator;
    Fac: IRubricatorFactor;
    MS: IMetabaseSecurity;
    User: IMetabaseUser;
Begin
    MB := MetabaseClass.Active;
    Rub := MB.ItemById(
"OBJ_RUBRICATOR").Bind As IRubricator;
    RubInst := (Rub 
As IMetabaseObjectDescriptor).Open(NullAs IRubricatorInstance;
    Fac := rubInst.GetFactData(
3).Factor;
    MS := MB.Security;
    User := MS.ResolveName(
"ADMIN"As IMetabaseUser;
    Debug.WriteLine(Fac.GetSubjectEffectiveRights(User));
End Sub UserProc;

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    RubInst: IRubricatorInstance;
    Rub: IRubricator;
    Fac: IRubricatorFactor;
    MS: IMetabaseSecurity;
    User: IMetabaseUser;
Begin
    MB := Params.Metabase;
    Rub := MB.ItemById[
"OBJ_RUBRICATOR"].Bind() As IRubricator;
    RubInst := (Rub 
As IMetabaseObjectDescriptor).Open(NullAs IRubricatorInstance;
    Fac := rubInst.GetFactData(
3, DictionaryGetDataOptions.dgdoNone).Factor;
    MS := MB.Security;
    User := MS.ResolveName(
"ADMIN"As IMetabaseUser;
    System.Diagnostics.Debug.WriteLine(Fac.GetSubjectEffectiveRights(User));
End Sub;

After executing the example the console displays effective permissions of the ADMIN user to the fact indicator with the 3 key. The permissions are represented in decimal form.

See also:

IRubricatorFactor