IRubricatorSegment.AsObject

Syntax

AsObject: IMetabaseObjectDescriptor;

Description

The AsObject method returns a temporary object for security descriptor editing.

Example

Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier that contains an attribute of the indicator with the COUNTRY identifier that refers to a dictionary.

Sub UserProc;
Var
    Mb: IMetabase;
    RubInst: IRubricatorInstance;
    Segs: IRubricatorSegments;
    Seg: IRubricatorSegment;
    Sd: ISecurityDescriptor;
    User: IMetabaseUser;
    Attr: IMetaAttribute;
    DI: IDimInstance;
    Sel: IDimSelection;
    SegmFact: IRubricatorFactorsSegment;
    SegmObject: IMetabaseObjectDescriptor;
Begin
    Mb := MetabaseClass.Active;
    RubInst := Mb.ItemById("OBJ_RUBRICATOR").Open(NullAs IRubricatorInstance;
    Segs := RubInst.Segments;
    Seg := Segs.CreateFactorsSegment As IRubricatorSegment;
    SegmObject := Seg.AsObject;
    Sd := SegmObject.SecurityDescriptor;
    Sd.Edit;
    User := MB.Security.ResolveName("ADMIN"As IMetabaseUser;
    Debug.WriteLine(Sd.GetEffectiveRights(User));
    Seg.AttributeName := "COUNTRY";
    Attr := RubInst.Rubricator.Facts.Attributes.FindById("COUNTRY");
    Seg.Attribute := Attr;
    DI := Attr.ValuesObject.Open(NullAs IDimInstance;
    Sel := DI.CreateSelection;
    Sel.SelectElement(0False);
    Sel.SelectElement(1False);
    SegmFact := Seg As IRubricatorFactorsSegment;
    SegmFact.SetSelection(Sel);
    Seg.Save;
End Sub UserProc;

After executing the example a segment that represents a data range is created in the time series database. The segment includes the first and the second dictionary elements, to which the COUNTRY attribute refers. The console window displays effective permissions of the ADMIN user.

See also:

IRubricatorSegment