diff --git a/resources/i18n/en.json5 b/resources/i18n/en.json5
index 975e8ec4e6..72a9530b54 100644
--- a/resources/i18n/en.json5
+++ b/resources/i18n/en.json5
@@ -226,6 +226,16 @@
"admin.access-control.epeople.form.notification.edited.failure": "Failed to edit EPerson \"{{name}}\"",
+ "admin.access-control.epeople.form.groupsEPersonIsMemberOf": "Member of these groups:",
+
+ "admin.access-control.epeople.form.table.id": "ID",
+
+ "admin.access-control.epeople.form.table.name": "Name",
+
+ "admin.access-control.epeople.form.memberOfNoGroups": "This EPerson is not a member of any groups",
+
+ "admin.access-control.epeople.form.goToGroups": "Add to groups",
+
"admin.access-control.epeople.notification.deleted.failure": "Failed to delete EPerson: \"{{name}}\"",
"admin.access-control.epeople.notification.deleted.success": "Successfully deleted EPerson: \"{{name}}\"",
diff --git a/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.html b/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.html
index 6d44dd7fa1..5ab10c94a3 100644
--- a/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.html
+++ b/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.html
@@ -15,3 +15,43 @@
(cancel)="onCancel()"
(submitForm)="onSubmit()">
+
+
+
{{messagePrefix + '.groupsEPersonIsMemberOf' | translate}}
+
+
0"
+ [paginationOptions]="config"
+ [pageInfoState]="(groups | async)?.payload"
+ [collectionSize]="(groups | async)?.payload?.totalElements"
+ [hideGear]="true"
+ [hidePagerWhenSinglePage]="true"
+ (pageChange)="onPageChange($event)">
+
+
+
+
+
+ {{messagePrefix + '.table.id' | translate}} |
+ {{messagePrefix + '.table.name' | translate}} |
+
+
+
+
+ {{group.id}} |
+ {{group.name}} |
+
+
+
+
+
+
+
+
+
{{messagePrefix + '.memberOfNoGroups' | translate}}
+
+
+
+
+
diff --git a/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts b/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts
index c6cae75ab0..d06bafb3a8 100644
--- a/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts
+++ b/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.ts
@@ -7,17 +7,21 @@ import {
DynamicInputModel
} from '@ng-dynamic-forms/core';
import { TranslateService } from '@ngx-translate/core';
-import { combineLatest } from 'rxjs/internal/observable/combineLatest';
-import { Subscription } from 'rxjs/internal/Subscription';
+import { Subscription, combineLatest } from 'rxjs';
+import { Observable } from 'rxjs/internal/Observable';
import { take } from 'rxjs/operators';
import { RestResponse } from '../../../../core/cache/response.models';
import { PaginatedList } from '../../../../core/data/paginated-list';
+import { RemoteData } from '../../../../core/data/remote-data';
import { EPersonDataService } from '../../../../core/eperson/eperson-data.service';
+import { GroupDataService } from '../../../../core/eperson/group-data.service';
import { EPerson } from '../../../../core/eperson/models/eperson.model';
+import { Group } from '../../../../core/eperson/models/group.model';
import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators';
import { hasValue } from '../../../../shared/empty.util';
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
+import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
@Component({
selector: 'ds-eperson-form',
@@ -106,12 +110,27 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
*/
subs: Subscription[] = [];
+ /**
+ * A list of all the groups this EPerson is a member of
+ */
+ groups: Observable>>;
+
+ /**
+ * Pagination config used to display the list of groups
+ */
+ config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
+ id: 'groups-ePersonMemberOf-list-pagination',
+ pageSize: 5,
+ currentPage: 1
+ });
+
/**
* Try to retrieve initial active eperson, to fill in checkboxes at component creation
*/
epersonInitial: EPerson;
constructor(public epersonService: EPersonDataService,
+ public groupsDataService: GroupDataService,
private formBuilderService: FormBuilderService,
private translateService: TranslateService,
private notificationsService: NotificationsService,) {
@@ -181,6 +200,10 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
];
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
+ this.groups = this.groupsDataService.findAllByHref(eperson._links.groups.href, {
+ currentPage: 1,
+ elementsPerPage: this.config.pageSize
+ });
this.formGroup.patchValue({
firstName: eperson != null ? eperson.firstMetadataValue('eperson.firstname') : '',
lastName: eperson != null ? eperson.firstMetadataValue('eperson.lastname') : '',
@@ -333,6 +356,26 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
});
}
+ /**
+ * Event triggered when the user changes page
+ * @param event
+ */
+ onPageChange(event) {
+ this.updateGroups({
+ currentPage: event,
+ elementsPerPage: this.config.pageSize
+ });
+ }
+
+ /**
+ * Update the list of groups by fetching it from the rest api or cache
+ */
+ private updateGroups(options) {
+ this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
+ this.groups = this.groupsDataService.findAllByHref(eperson._links.groups.href, options);
+ }));
+ }
+
/**
* Cancel the current edit when component is destroyed & unsub all subscriptions
*/
diff --git a/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.html b/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.html
index 47c61cb024..0cf0c6dd0b 100644
--- a/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.html
+++ b/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.html
@@ -24,7 +24,7 @@
-
+
diff --git a/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.ts b/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.ts
index eb75a1d024..415a0bb12e 100644
--- a/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.ts
+++ b/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.ts
@@ -134,7 +134,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
onCancel() {
this.groupDataService.cancelEditGroup();
this.cancelForm.emit();
- this.router.navigate(['/admin/access-control/groups']);
+ this.router.navigate([this.groupDataService.getGroupRegistryRouterLink()]);
}
/**
diff --git a/src/app/core/eperson/group-data.service.ts b/src/app/core/eperson/group-data.service.ts
index dc331d0b2c..17c9829483 100644
--- a/src/app/core/eperson/group-data.service.ts
+++ b/src/app/core/eperson/group-data.service.ts
@@ -255,4 +255,12 @@ export class GroupDataService extends DataService {
});
}
+ public getGroupRegistryRouterLink(): string {
+ return '/admin/access-control/groups';
+ }
+
+ public getGroupEditPageRouterLink(groupId: string): string {
+ return '/admin/access-control/groups/' + groupId;
+ }
+
}