UNPKG

@awhere/api

Version:

The awesome aWhere API for JavaScript.

75 lines 2.41 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var interfaces_1 = require("@awhere/interfaces"); var AccessibleGroup_1 = __importDefault(require("./AccessibleGroup")); var AccessibleUser_1 = __importDefault(require("./AccessibleUser")); var Permission = /** @class */ (function () { function Permission(props) { if (props === void 0) { props = {}; } this._scope = interfaces_1.PermissionScope.private; this._groups = []; this._users = []; if (props.scope !== undefined) { this._scope = props.scope; } if (props.groups !== undefined) { if (props.groups) { this._groups = props.groups.map(function (group) { return new AccessibleGroup_1.default(group); }); } else if (props.groups) { this._groups = props.groups; } } if (props.users !== undefined) { if (props.users) { this._users = props.users.map(function (user) { return new AccessibleUser_1.default(user); }); } else if (props.users) { this._users = props.users; } } } Object.defineProperty(Permission.prototype, "scope", { get: function () { return this._scope; }, set: function (v) { this._scope = v; }, enumerable: false, configurable: true }); Object.defineProperty(Permission.prototype, "groups", { get: function () { return this._groups; }, set: function (v) { this._groups = v; }, enumerable: false, configurable: true }); Object.defineProperty(Permission.prototype, "users", { get: function () { return this._users; }, set: function (v) { this._users = v; }, enumerable: false, configurable: true }); Permission.prototype.toJSON = function () { return { scope: this._scope, users: this._users, groups: this._groups, }; }; return Permission; }()); exports.default = Permission; //# sourceMappingURL=Permission.js.map