AccessToken: IAccessToken;
The AccessToken property returns the object access label saved in update.
It is relevant when the mandatory access control method is used. Conditions for using the property:
The IMetabaseUpdateObjectNode.UpdatePart property is set to ReplaceSecurityDescriptor.
The IMetabaseUpdateObjectNode.AccessTokenOptions property is set to Manual.
If the specified conditions are satisfied, the AccessToken property can be used to change label access parameters for the object. The changed parameters will be saved in update.
Access label parameters will be copied from source object (IMetabaseObjectDescriptor->SecurityDescriptor->AccessToken) if at least one condition is not satisfied.
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 with the access label of the OBJ1 object.
See also: