ISecurityDescriptor.Apply

Syntax

Apply(ApplyByHierarchy: Boolean);

Parameters

ApplyByHierarchy. A parameter that determines whether the security parameters of all child objects are set in accordance with the security parameters of the current object.

If True is passed, the security parameters for all child objects are set in accordance with parameters of the current object.

If False is passed, the parameters are applied only for the current object but they spread to all child objects for which the SecurityDescriptorFlags.AutoInherited value was set for the Flags flag.

Description

The Apply method escapes from the edit mode saving all changes of the object security parameters.

Example

Executing the example requires that the repository contains an object with the Obj_1 identifier.

Sub Main;

Var

MB: IMetabase;

ObjDesc: IMetabaseObjectDescriptor;

SecDesc: ISecurityDescriptor;

AcessCL: IAccessControlList;

ACE: IAccessControlEntry;

Sec: IMetabaseSecurity;

SS: ISecuritySubject;

Sid: ISid;

Begin

MB := MetabaseClass.Active;

ObjDesc := MB.ItemById("Obj_1");

SecDesc := ObjDesc.SecurityDescriptor;

Sec := MB.Security;

SS := Sec.AllUsers.Item(10);

Sid := SS.Sid;

SecDesc.Edit;

AcessCL := SecDesc.Acl;

ACE := AcessCL.AddAce(AceType.AccessAllowed, Sid, 131071);

SecDesc.Apply(False);

End Sub Main;

After executing the example the user is added to the access control parameters for the specified object. Permissions in accordance with the "131071" mask (Full Access) are set for it in additional parameters. These changes are applied only for the specified object.

See also:

ISecurityDescriptor | ISecurityDescriptor.Edit