[MNT-21595] Content - Expose a group service for content (#5833)

* Expose a group service for content

* Use nx command and remove smart-build
This commit is contained in:
Maurizio Vitale 2020-07-13 12:22:54 +01:00 committed by GitHub
parent 179ce2e8eb
commit 42d88fdaa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 94 deletions

View File

@ -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';

View File

@ -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';

View File

@ -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<GroupEntry[]> {
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;
}
}
}

View File

@ -179,7 +179,7 @@ export class NodePermissionService {
* @returns List of members
*/
getGroupMemberByGroupName(groupName: string, opts?: any): Observable<GroupMemberPaging> {
return from(this.apiService.groupsApi.getGroupMembers(groupName, opts));
return from(this.apiService.groupsApi.listGroupMemberships(groupName, opts));
}
private formattedRoleName(displayName, siteName): string {

View File

@ -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';

View File

@ -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(

View File

@ -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

View File

@ -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