Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { Community } from '../../../../core/shared/community.model';
import { Collection } from '../../../../core/shared/collection.model';
/**
* Class representing a community or collection role.
*/
export class ComcolRole {
/**
* The admin role.
*/
public static ADMIN = new ComcolRole(
'admin',
'adminGroup',
);
/**
* @param name The name for this community or collection role.
* @param linkName The path linking to this community or collection role.
*/
constructor(
public name,
public linkName,
) {
}
/**
* Get the REST endpoint for managing this role for a given community or collection.
* @param dso
*/
public getEndpoint(dso: Community | Collection) {
let linkPath;
switch (dso.type + '') {
case 'community':
linkPath = 'communities';
break;
case 'collection':
linkPath = 'collections';
break;
}
return `${linkPath}/${dso.uuid}/${this.linkName}`;
}
}