GetSubjectEffectiveRights(Subject: ISecuritySubject): Integer;
Subject. Security subject, which effective permissions must be obtained.
The GetSubjectEffectiveRights method returns effective permissions of the specified user.
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, use values of the MetabaseObjectPredefinedRights enumerable type in combination with CubeSpecificRights. To parse mask value, implement the custom function that enables the user to map separate mask bits to appropriate enumeration values. The example of work with access mask is provided in the Examples: Work with Access Mask section. The Read and Write operations are used when permissions to a segment are granted.
Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier, in which segments must be determined.
Sub Main;
Var
mb: IMetabase;
rubInst: IRubricatorInstance;
Rub: IRubricator;
Segs: IRubricatorSegments;
Seg: IRubricatorSegment;
mbSec: IMetabaseSecurity;
User: IMetabaseUser;
Begin
mb := MetabaseClass.Active;
Rub := mb.ItemById("OBJ_RUBRICATOR").Bind As IRubricator;
rubInst := (Rub As IMetabaseObjectDescriptor).Open(Null) As IRubricatorInstance;
Segs := rubInst.Segments;
Seg := Segs.Item(0);
mbSec := MB.Security;
User := mbSec.ResolveName("ADMIN") As IMetabaseUser;
Debug.WriteLine(Seg.GetSubjectEffectiveRights(User));
End Sub Main;
After executing the example effective permissions of the ADMIN user to the first data segment are displayed in the console window in decimal form.
See also: