Initial role API.
This commit is contained in:
parent
7d1d34d1eb
commit
05063b76eb
@ -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'
|
||||
|
@ -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
|
||||
}
|
||||
|
16
src/api/role.js
Normal file
16
src/api/role.js
Normal file
@ -0,0 +1,16 @@
|
||||
export async function getAll () {
|
||||
return [
|
||||
{
|
||||
id: 'r0',
|
||||
name: 'Observer'
|
||||
},
|
||||
{
|
||||
id: 'r1',
|
||||
name: 'User'
|
||||
},
|
||||
{
|
||||
id: 'r2',
|
||||
name: 'Manager'
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user