diff --git a/lib/content-services/src/lib/group/index.ts b/lib/content-services/src/lib/group/index.ts new file mode 100644 index 0000000000..a7e30cc675 --- /dev/null +++ b/lib/content-services/src/lib/group/index.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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. + */ + +export * from './public-api'; diff --git a/lib/content-services/src/lib/group/public-api.ts b/lib/content-services/src/lib/group/public-api.ts new file mode 100644 index 0000000000..c0cc39fb80 --- /dev/null +++ b/lib/content-services/src/lib/group/public-api.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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. + */ + +export * from './services/group.service'; diff --git a/lib/content-services/src/lib/group/services/group.service.ts b/lib/content-services/src/lib/group/services/group.service.ts new file mode 100644 index 0000000000..437d3a874c --- /dev/null +++ b/lib/content-services/src/lib/group/services/group.service.ts @@ -0,0 +1,43 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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 { Injectable } from '@angular/core'; +import { GroupEntry } from '@alfresco/js-api'; +import { AlfrescoApiService } from '@alfresco/adf-core'; + +@Injectable({ + providedIn: 'root' +}) +export class GroupService { + constructor( + private alfrescoApiService: AlfrescoApiService + ) {} + + async listAllGroupMembershipsForPerson(personId: string, opts?: any, accumulator = []): Promise { + const groupsPaginated = await this.alfrescoApiService.groupsApi.listGroupMembershipsForPerson(personId, opts); + accumulator = [...accumulator, ...groupsPaginated.list.entries]; + if (groupsPaginated.list.pagination.hasMoreItems) { + const skip = groupsPaginated.list.pagination.skipCount + groupsPaginated.list.pagination.count; + return this.listAllGroupMembershipsForPerson(personId, { + maxItems: opts.maxItems, + skipCount: skip + }, accumulator); + } else { + return accumulator; + } + } +} diff --git a/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts b/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts index d50c870c1d..2833659e7e 100644 --- a/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts +++ b/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts @@ -179,7 +179,7 @@ export class NodePermissionService { * @returns List of members */ getGroupMemberByGroupName(groupName: string, opts?: any): Observable { - return from(this.apiService.groupsApi.getGroupMembers(groupName, opts)); + return from(this.apiService.groupsApi.listGroupMemberships(groupName, opts)); } private formattedRoleName(displayName, siteName): string { diff --git a/lib/content-services/src/public-api.ts b/lib/content-services/src/public-api.ts index 607e046174..4050290b84 100644 --- a/lib/content-services/src/public-api.ts +++ b/lib/content-services/src/public-api.ts @@ -32,5 +32,6 @@ export * from './lib/content-metadata/index'; export * from './lib/permission-manager/index'; export * from './lib/content-node-share/index'; export * from './lib/tree-view/index'; +export * from './lib/group/index'; export * from './lib/content.module'; diff --git a/lib/core/services/alfresco-api.service.ts b/lib/core/services/alfresco-api.service.ts index b7aeaae4fb..2d15386797 100644 --- a/lib/core/services/alfresco-api.service.ts +++ b/lib/core/services/alfresco-api.service.ts @@ -22,6 +22,7 @@ import { Activiti, SearchApi, Node, + GroupsApi, AlfrescoApiCompatibility, AlfrescoApiConfig } from '@alfresco/js-api'; import { AppConfigService, AppConfigValues } from '../app-config/app-config.service'; @@ -95,8 +96,8 @@ export class AlfrescoApiService { return this.getInstance().core.classesApi; } - get groupsApi(): Core.GroupsApi { - return this.getInstance().core.groupsApi; + get groupsApi(): GroupsApi { + return new GroupsApi(this.getInstance()); } constructor( diff --git a/scripts/smart-build.sh b/scripts/smart-build.sh deleted file mode 100755 index 13ff62c4f7..0000000000 --- a/scripts/smart-build.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env bash - -eval GNU=false - -show_help() { - echo "Usage: smart-build.sh" - echo "" - echo "-gnu for gnu" -} - -gnu_mode() { - echo "====== GNU MODE =====" - GNU=true -} - -while [[ $1 == -* ]]; do - case "$1" in - -gnu) gnu_mode; shift;; - -*) echo "invalid option: $1" 1>&2; show_help; exit 0;; - esac -done - -if $GNU; then - gnu='-gnu' -else - gnu='' -fi - -affected="$(nx affected:libs --base=$BASE_HASH --head=$HEAD_HASH --plain)" -echo $affected -libs=(`echo $affected | sed 's/^$/\n/g'`) - -for i in "${libs[@]}" -do - if [ "$i" == "extensions" ] ; then - ./scripts/build/build-extensions.sh || exit 1; - fi -done - -for i in "${libs[@]}" -do - if [ "$i" == "core" ] ; then - ./scripts/build/build-core.sh || exit 1; - fi -done - -for i in "${libs[@]}" -do - if [ "$i" == "content-services" ] ; then - ./scripts/build/build-content-services.sh || exit 1; - fi -done - -for i in "${libs[@]}" -do - if [ "$i" == "process-services" ] ; then - ./scripts/build/build-process-services.sh || exit 1; - fi -done - -for i in "${libs[@]}" -do - if [ "$i" == "process-services-cloud" ] ; then - ./scripts/build/build-process-services-cloud.sh || exit 1; - fi -done - -for i in "${libs[@]}" -do - if [ "$i" == "insights" ] ; then - ./scripts/build/build-insights.sh || exit 1; - fi -done - -for i in "${libs[@]}" -do - if [ "$i" == "testing" ] ; then - ./scripts/build/build-testing.sh || exit 1; - fi -done - -for i in "${libs[@]}" -do - if [ "$i" == "cli" ] ; then - ./scripts/build/build-cli.sh || exit 1; - fi -done diff --git a/scripts/travis/build/build.sh b/scripts/travis/build/build.sh index 6c130e9963..a1c4428d5b 100755 --- a/scripts/travis/build/build.sh +++ b/scripts/travis/build/build.sh @@ -29,9 +29,6 @@ else echo "====== Update the package.json with latest ADW deps =====" npx @alfresco/adf-cli@alpha update-version --alpha --pathPackage "$(pwd)" npm install; - - ./scripts/smart-build.sh -gnu || exit 1; fi; -echo "====== Build Demo shell for production =====" -npm run build:prod || exit 1; +nx affected --target=build --base=$BASE_HASH --head=$HEAD_HASH --exclude=cli --prod --with-deps