mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 06:23:03 +00:00
61561: fixed ui issue for DS-4006
This commit is contained in:
@@ -4,6 +4,7 @@ import { NormalizedAuthStatus } from './models/normalized-auth-status.model';
|
|||||||
import { NormalizedEPerson } from '../eperson/models/normalized-eperson.model';
|
import { NormalizedEPerson } from '../eperson/models/normalized-eperson.model';
|
||||||
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
||||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||||
|
import { NormalizedGroup } from '../eperson/models/normalized-group.model';
|
||||||
|
|
||||||
export class AuthObjectFactory {
|
export class AuthObjectFactory {
|
||||||
public static getConstructor(type): GenericConstructor<NormalizedObject<CacheableObject>> {
|
public static getConstructor(type): GenericConstructor<NormalizedObject<CacheableObject>> {
|
||||||
@@ -12,6 +13,10 @@ export class AuthObjectFactory {
|
|||||||
return NormalizedEPerson
|
return NormalizedEPerson
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AuthType.Group: {
|
||||||
|
return NormalizedGroup
|
||||||
|
}
|
||||||
|
|
||||||
case AuthType.Status: {
|
case AuthType.Status: {
|
||||||
return NormalizedAuthStatus
|
return NormalizedAuthStatus
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
export enum AuthType {
|
export enum AuthType {
|
||||||
EPerson = 'eperson',
|
EPerson = 'eperson',
|
||||||
Status = 'status'
|
Status = 'status',
|
||||||
|
Group = 'group'
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,6 @@ export abstract class BaseResponseParsingService {
|
|||||||
} else if (Array.isArray(data)) {
|
} else if (Array.isArray(data)) {
|
||||||
return this.processArray(data, requestUUID);
|
return this.processArray(data, requestUUID);
|
||||||
} else if (isRestDataObject(data)) {
|
} else if (isRestDataObject(data)) {
|
||||||
data = this.fixBadEPersonRestResponse(data);
|
|
||||||
const object = this.deserialize(data);
|
const object = this.deserialize(data);
|
||||||
if (isNotEmpty(data._embedded)) {
|
if (isNotEmpty(data._embedded)) {
|
||||||
Object
|
Object
|
||||||
@@ -141,23 +140,4 @@ export abstract class BaseResponseParsingService {
|
|||||||
protected retrieveObjectOrUrl(obj: any): any {
|
protected retrieveObjectOrUrl(obj: any): any {
|
||||||
return this.toCache ? obj.self : obj;
|
return this.toCache ? obj.self : obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Remove when https://jira.duraspace.org/browse/DS-4006 is fixed
|
|
||||||
// See https://github.com/DSpace/dspace-angular/issues/292
|
|
||||||
private fixBadEPersonRestResponse(obj: any): any {
|
|
||||||
if (obj.type === ResourceType.EPerson) {
|
|
||||||
const groups = obj.groups;
|
|
||||||
const normGroups = [];
|
|
||||||
if (isNotEmpty(groups)) {
|
|
||||||
groups.forEach((group) => {
|
|
||||||
const parts = ['eperson', 'groups', group.uuid];
|
|
||||||
const href = new RESTURLCombiner(this.EnvConfig, ...parts).toString();
|
|
||||||
normGroups.push(href);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return Object.assign({}, obj, { groups: normGroups });
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user