2016-10-10 18:37:26 +03:00
|
|
|
const request = require('./request');
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.list = () => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('listRoles');
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.get = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('getRole', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.create = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('createRole', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.set = ctx => {
|
2017-04-17 16:56:10 +03:00
|
|
|
const id = ctx.id ? `/${ctx.id}` : '';
|
2016-10-10 18:37:26 +03:00
|
|
|
const resource = `/${request.client.account}/${ctx.resource}${id}`;
|
|
|
|
|
|
|
|
return request('setRoleTags', {
|
|
|
|
roleTags: ctx.role,
|
|
|
|
resource
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.update = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('updateRole', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.destroy = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('deleteRole', ctx);
|
|
|
|
};
|