var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var Unibase; (function (Unibase) { let Platform; (function (Platform) { let Permissions; (function (Permissions) { let Managers; (function (Managers) { class PermissionManager extends Platform.Core.BaseManager { getRoleSettings(roleId, InstalledAppId, IsStage) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/roles/getrolesettingsbyroleandstage/roleid/' + roleId + '/installedappid/' + InstalledAppId + '/isstage/' + IsStage; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getRoleSettingsbyAppId(InstalledAppId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getapppermissions/installedappid/' + InstalledAppId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getRoles(term) { return __awaiter(this, void 0, void 0, function* () { if (term == "") { term = undefined; } const url = 'apis/v4/unibase/platform/roles/get/term/' + term; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getInternalRoles() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/roles/getinternalrolesautocomplete'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getRole(roleid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/roles/getrole/roleid/' + roleid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } saveRoleSetting(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/roles/saverolesetting'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); ; }); } saveRole(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/roles/saverole'; var result; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getUserRoles(contactid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/roles/getuserroles/' + contactid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } static Instance() { if (this._instance === undefined) this._instance = new PermissionManager(); return this._instance; } } Managers.PermissionManager = PermissionManager; })(Managers = Permissions.Managers || (Permissions.Managers = {})); })(Permissions = Platform.Permissions || (Platform.Permissions = {})); })(Platform = Unibase.Platform || (Unibase.Platform = {})); })(Unibase || (Unibase = {}));