Skip to content

Latest commit

 

History

History
72 lines (55 loc) · 2.19 KB

add-permission-dialog.component.md

File metadata and controls

72 lines (55 loc) · 2.19 KB
Title Added Status Last reviewed
Add Permission Dialog Component
v2.4.0
Active
2024-05-07

Add Permission Dialog Component

import { NodePermissionDialogService } from '@alfresco/adf-content-services';

Displays a dialog to search for people or groups to add to the current node permissions.

Add Permission Component

Basic Usage

import { NodePermissionDialogService } from '@alfresco/adf-content-services';
import { inject } from '@angular/core';

export class MyComponent {
    private nodePermissionDialogService = inject(NodePermissionDialogService);

    showDialog() {
        this.nodePermissionDialogService
            .openAddPermissionDialog(this.nodeId)
            .subscribe((selectedNodes) => {
                //action for selected nodes
            },
            (error) => {
                this.showErrorMessage(error);
            });
    }
}

Details

This component extends the Add permission panel component to apply the chosen selection of permissions when they are accepted.

You can open the dialog with the openAddPermissionDialog method from the Node Permission Dialog Service. This returns an Observable that you can subscribe to, so you can get the details of the node after the update.

Use the updateNodePermissionByDialog method from the service to update node permissions, as shown in the following example:

import { NodePermissionDialogService } from '@alfresco/adf-content-services';
import { inject } from '@angular/core';

export class MyComponent {
    private nodePermissionDialogService = inject(NodePermissionDialogService);
    
    updateNodePermissions() {
        this.nodePermissionDialogService.updateNodePermissionByDialog(this.nodeId).subscribe((node) => {
            //updated node
        },
        (error) => {
            this.showErrorMessage(error);
        });
    }
}

See also