mirror of
https://github.com/documize/community.git
synced 2025-08-01 19:45:24 +02:00
list group members & non-members
This commit is contained in:
parent
19b4a3de49
commit
0680a72ee2
15 changed files with 360 additions and 60 deletions
|
@ -64,5 +64,35 @@ export default BaseService.extend({
|
|||
return this.get('ajax').request(`group/${groupId}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// Returns users associated with given group
|
||||
getGroupMembers(groupId) {
|
||||
return this.get('ajax').request(`group/${groupId}/members`, {
|
||||
method: 'GET'
|
||||
}).then((response) => {
|
||||
let data = [];
|
||||
|
||||
data = response.map((obj) => {
|
||||
let data = this.get('store').normalize('group-member', obj);
|
||||
return this.get('store').push(data);
|
||||
});
|
||||
|
||||
return data;
|
||||
});
|
||||
},
|
||||
|
||||
// join adds user to group.
|
||||
join(groupId, userId) {
|
||||
return this.get('ajax').request(`group/${groupId}/join/${userId}`, {
|
||||
method: 'POST'
|
||||
});
|
||||
},
|
||||
|
||||
// leave removes user from group.
|
||||
leave(groupId, userId) {
|
||||
return this.get('ajax').request(`group/${groupId}/leave/${userId}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue