@aecworks/bimbox-bimserver-sdk-js
Version:
AECWorks BIMBox 产品线 BIMServer 的 sdk 的 JavaScript 实现,采用Typescript语言
80 lines • 3.56 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import * as proxy from '../proxy';
import ServiceBase from '../base';
import { PermissionsProxy, RoleProxy, RolesProxy } from '../proxies/auth-proxy';
var ACCOUNTS = '/accounts';
var ROLES = '/roles';
var RolesService = /** @class */ (function (_super) {
__extends(RolesService, _super);
function RolesService() {
var _this = _super !== null && _super.apply(this, arguments) || this;
// 角色和权限相关
_this.getAccountRoles = function (data) {
var promise = _super.prototype.get.call(_this, {
url: ACCOUNTS + "/" + data.accountId + ROLES,
});
return proxy.httpResultProxy(promise, RolesProxy);
};
_this.addAccountRole = function (data) {
var promise = _super.prototype.post.call(_this, {
url: ACCOUNTS + "/" + data.accountId + ROLES,
data: data.data,
});
return proxy.httpResultProxy(promise, RoleProxy);
};
_this.setDefaultAccountRole = function (data) {
var promise = _super.prototype.put.call(_this, {
url: ACCOUNTS + "/" + data.accountId + ROLES + "/" + data.roleId + "/default",
});
return proxy.httpResultProxy(promise);
};
_this.switchAccountRoleState = function (data) {
var promise = _super.prototype.put.call(_this, {
url: ACCOUNTS + "/" + data.accountId + ROLES + "/" + data.roleId + "/state",
data: data.data,
});
return proxy.httpResultProxy(promise);
};
_this.deleteAccountRole = function (data) {
var promise = _super.prototype.delete.call(_this, {
url: ACCOUNTS + "/" + data.accountId + ROLES + "/" + data.roleId,
});
return proxy.httpResultProxy(promise);
};
_this.getAccountRoleById = function (data) {
var promise = _super.prototype.get.call(_this, {
url: ACCOUNTS + "/" + data.accountId + ROLES + "/" + data.roleId,
});
return proxy.httpResultProxy(promise, RoleProxy);
};
_this.updateAccountRole = function (data) {
var promise = _super.prototype.put.call(_this, {
url: ACCOUNTS + "/" + data.accountId + ROLES + "/" + data.roleId,
data: data.data,
});
return proxy.httpResultProxy(promise, RoleProxy);
};
_this.getAddInPermissions = function (data) {
var promise = _super.prototype.get.call(_this, {
url: "/accounts/" + data.accountId + "/permissions",
});
return proxy.httpResultProxy(promise, PermissionsProxy);
};
return _this;
}
return RolesService;
}(ServiceBase));
export default RolesService;
//# sourceMappingURL=roles.js.map