@alfresco/adf-content-services
Version:
Alfresco ADF content services
129 lines (128 loc) • 5.1 kB
TypeScript
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AlfrescoApiService } from '../../services/alfresco-api.service';
import { TranslationService } from '@alfresco/adf-core';
import { NodesApiService } from '../../common/services/nodes-api.service';
import { EcmUserModel } from '../../common/models/ecm-user.model';
import { Group, GroupMemberPaging, GroupsApi, Node, PermissionElement } from '@alfresco/js-api';
import { SearchService } from '../../search/services/search.service';
import { Observable } from 'rxjs';
import { PermissionDisplayModel } from '../models/permission.model';
import { RoleModel } from '../models/role.model';
import * as i0 from "@angular/core";
export declare class NodePermissionService {
private apiService;
private searchApiService;
private nodeService;
private translation;
private _groupsApi;
get groupsApi(): GroupsApi;
constructor(apiService: AlfrescoApiService, searchApiService: SearchService, nodeService: NodesApiService, translation: TranslationService);
/**
* Gets a list of roles for the current node.
*
* @param node The target node
* @returns Array of strings representing the roles
*/
getNodeRoles(node: Node): Observable<string[]>;
/**
* Get permissions for a given node
*
* @param node Node to check permissions for
* @returns list of permission models
*/
getNodePermissions(node: Node): PermissionDisplayModel[];
/**
* Updates the permission role for a node.
*
* @param node Target node
* @param updatedPermissionRole Permission role to update or add
* @returns Node with updated permission
*/
updatePermissionRole(node: Node, updatedPermissionRole: PermissionElement): Observable<Node>;
/**
* Update permissions for a node.
*
* @param nodeId ID of the target node
* @param permissionList New permission settings
* @returns Node with updated permissions
*/
updateNodePermissions(nodeId: string, permissionList: PermissionElement[]): Observable<Node>;
/**
* Updates the locally set permissions for a node.
*
* @param node ID of the target node
* @param permissions Permission settings
* @returns Node with updated permissions
*/
updateLocallySetPermissions(node: Node, permissions: PermissionElement[]): Observable<Node>;
private getDuplicatedPermissions;
private isEqualPermission;
/**
* Removes a permission setting from a node.
*
* @param node ID of the target node
* @param permissionToRemove Permission setting to remove
* @returns Node with modified permissions
*/
removePermission(node: Node, permissionToRemove: PermissionElement): Observable<Node>;
private getGroupMembersBySiteName;
/**
* Gets all members related to a group name.
*
* @param groupName Name of group to look for members
* @param opts Extra options supported by JS-API
* @returns List of members
*/
getGroupMemberByGroupName(groupName: string, opts?: any): Observable<GroupMemberPaging>;
private formattedRoleName;
private buildRetrieveSiteQueryBody;
getLocalPermissions(node: Node): PermissionDisplayModel[];
getInheritedPermission(node: Node): PermissionDisplayModel[];
/**
* Removes permissions setting from a node.
*
* @param node target node with permission
* @param permissions Permissions to remove
* @returns Node with modified permissions
*/
removePermissions(node: Node, permissions: PermissionElement[]): Observable<Node>;
/**
* updates permissions setting from a node.
*
* @param node target node with permission
* @param permissions Permissions to update
* @returns Node with modified permissions
*/
updatePermissions(node: Node, permissions: PermissionElement[]): Observable<Node>;
/**
* Gets all node detail for nodeId along with settable permissions.
*
* @param nodeId Id of the node
* @returns node and it's associated roles { node: Node; roles: RoleModel[] }
*/
getNodeWithRoles(nodeId: string): Observable<{
node: Node;
roles: RoleModel[];
}>;
transformNodeToUserPerson(node: Node): {
person: EcmUserModel;
group: Group;
};
static ɵfac: i0.ɵɵFactoryDeclaration<NodePermissionService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<NodePermissionService>;
}