2016-10-10 18:37:26 +03:00
|
|
|
const request = require('./request');
|
|
|
|
|
|
|
|
module.exports.list = (ctx) => {
|
|
|
|
return request('listRoles');
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.get = (ctx) => {
|
|
|
|
return request('getRole', ctx);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.create = (ctx) => {
|
|
|
|
return request('createRole', ctx);
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.update = (ctx) => {
|
|
|
|
return request('updateRole', ctx);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.destroy = (ctx) => {
|
|
|
|
return request('deleteRole', ctx);
|
|
|
|
};
|