async dropEntitySharedOwner()

in src/lib/service/custos-service/custos-service-sharing.js [138:174]


    async dropEntitySharedOwner({clientId, entityId, permissionTypeId, groupIds = [], usernames = []}) {
        const axiosInstance = await this.custosService.axiosInstance;

        let promises = [];

        promises.concat(groupIds.map(groupId => {
            return axiosInstance.delete(
                `${CustosService.ENDPOINTS.SHARING}/groups/share`,
                {
                    data: {
                        "client_id": clientId,
                        "entity": {"id": entityId},
                        "permission_type": {"id": permissionTypeId},
                        "owner_id": [groupId],
                        "cascade": true
                    }
                }
            );
        }));

        promises.concat(usernames.map(username => {
            return axiosInstance.delete(
                `${CustosService.ENDPOINTS.SHARING}/users/share`,
                {
                    data: {
                        "client_id": clientId,
                        "entity": {"id": entityId},
                        "permission_type": {"id": permissionTypeId},
                        "owner_id": [username],
                        "cascade": true
                    }
                }
            );
        }));

        await Promise.all(promises);
    }