diff --git a/src/api/acl.js b/src/api/acl.js index 5b0d993ae..f9e4c1896 100644 --- a/src/api/acl.js +++ b/src/api/acl.js @@ -18,8 +18,8 @@ getCurrent.description = 'get existing ACLs concerning current user' // ------------------------------------------------------------------- -export async function add ({subject, object}) { - await this.addAcl(subject, object) +export async function add ({subject, object, role}) { + await this.addAcl(subject, object, role) } add.permission = 'admin' @@ -33,8 +33,8 @@ add.description = 'add a new ACL entry' // ------------------------------------------------------------------- -export async function remove ({subject, object}) { - await this.removeAcl(subject, object) +export async function remove ({subject, object, role}) { + await this.removeAcl(subject, object, role) } remove.permission = 'admin' diff --git a/src/api/group.js b/src/api/group.js index 2c4f0aa6b..15410e49a 100644 --- a/src/api/group.js +++ b/src/api/group.js @@ -10,6 +10,8 @@ create.params = { name: {type: 'string'} } +// ------------------------------------------------------------------- + // Deletes an existing group. async function delete_ ({id}) { return true @@ -24,6 +26,8 @@ delete_.params = { id: {type: 'string'} } +// ------------------------------------------------------------------- + export async function getAll () { return [ { @@ -45,6 +49,8 @@ delete_.params = { id: {type: 'string'} } +// ------------------------------------------------------------------- + // sets group.users with an array of user ids export async function setUsers ({id, userIds}) { return true @@ -57,6 +63,8 @@ setUsers.params = { userIds: {} } +// ------------------------------------------------------------------- + // adds the user id to group.users export async function addUser ({id, userId}) { return true @@ -69,11 +77,15 @@ addUser.params = { userId: {type: 'string'} } +// ------------------------------------------------------------------- + // remove the user id from group.users export async function removeUser ({id, userId}) { return true } +// ------------------------------------------------------------------- + removeUser.description = 'removes a user from a group' removeUser.permission = 'admin' removeUser.params = { @@ -81,6 +93,8 @@ removeUser.params = { userId: {type: 'string'} } +// ------------------------------------------------------------------- + export async function set ({id, name}) { return true } diff --git a/src/api/role.js b/src/api/role.js new file mode 100644 index 000000000..a5a6749fc --- /dev/null +++ b/src/api/role.js @@ -0,0 +1,16 @@ +export async function getAll () { + return [ + { + id: 'r0', + name: 'Observer' + }, + { + id: 'r1', + name: 'User' + }, + { + id: 'r2', + name: 'Manager' + } + ] +}