IMetabaseUpdateObjectNode.AccessToken

Fore Syntax

AccessToken: IAccessToken;

Fore.NET Syntax

AccessToken: Prognoz.Platform.Interop.Metabase.IAccessToken;

Description

The AccessToken property returns object access label saved in update.

Comments

Relevant on using the mandatory method of the access control. Conditions for using the property:

If the specified conditions are met, on using the AccessToken property, it is possible to change parameters of access label for the object. Changed parameters will be saved in update.

Access label parameters will be copied from initial object (IMetabaseObjectDescriptor->SecurityDescriptor->AccessToken), if at least one condition is not met.

Fore Example

Executing the example requires that the repository contains objects with the OBJ1 and OBJ2 identifiers. Add a link to the Metabase system assembly.

Sub UserProc;
Var
    Mb: IMetabase;
    Obj: IMetabaseObjectDescriptor;
    Upd: IMetabaseUpdate;
    Nd: IMetabaseUpdateObjectNode;
    RootFolder: IMetabaseUpdateFolderNode;
    ObjDesc: IMetabaseObjectDescriptor;
    SecDesc: ISecurityDescriptor;
    Tok: IAccessToken;
Begin
    Mb := MetabaseClass.Active;
    ObjDesc := MB.ItemById("OBJ1");
    SecDesc := ObjDesc.SecurityDescriptor;
    Tok := SecDesc.AccessToken;
    Upd := Mb.CreateUpdate;
    RootFolder := Upd.RootFolder;
    Nd := RootFolder.Add(MetabaseUpdateNodeType.Object) As IMetabaseUpdateObjectNode;
    Upd.AllowReplaceSD := True;
    Nd.UpdatePart := MetabaseObjectUpdatePart.ReplaceSecurityDescriptor;
    Nd.AccessTokenOptions := MetabaseUpdateAccessTokenOptions.Manual;
    Obj := Mb.ItemById("OBJ2").Bind;
    Nd.Object := Obj;
    Nd.AccessToken.Assign(Tok);
    Upd.SaveToFileNF("C:\Update.pefx");
    Upd := Mb.CreateUpdate;
    Upd.LoadFromFileNF("C:\Update.pefx");
    Upd.Apply;
End Sub UserProc;

On executing the example the created update is installed. After executing the example the access label of the OBJ2 object will be replaced by the access label of the OBJ1 object.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Metabase;

Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    Obj: IMetabaseObjectDescriptor;
    Upd: IMetabaseUpdate;
    Nd: IMetabaseUpdateObjectNode;
    RootFolder: IMetabaseUpdateFolderNode;
    ObjDesc: IMetabaseObjectDescriptor;
    SecDesc: ISecurityDescriptor;
    Tok: IAccessToken;
Begin
    Mb := Params.Metabase;
    ObjDesc := MB.ItemById["OBJ1"];
    SecDesc := ObjDesc.SecurityDescriptor;
    Tok := SecDesc.AccessToken;
    Upd := Mb.CreateUpdate();
    RootFolder := Upd.RootFolder;
    Nd := RootFolder.Add(MetabaseUpdateNodeType.untObject) As IMetabaseUpdateObjectNode;
    Upd.AllowReplaceSD := True;
    Nd.UpdatePart := MetabaseObjectUpdatePart.moupReplaceSecurityDescriptor;
    Nd.AccessTokenOptions := MetabaseUpdateAccessTokenOptions.muatoManual;
    Obj := Mb.ItemById["OBJ2"].Bind();
    Nd.Object := Obj;
    Nd.AccessToken.Assign(Tok);
    Upd.SaveToFileNF("D:\" + "Update.pefx");
    Upd := Mb.CreateUpdate();
    Upd.LoadFromFileNF("D:\" + "Update.pefx", UpdateLoadMode.ulmReplace);
    Upd.Apply(Null);
End Sub;

See also:

IMetabaseUpdateObjectNode