Comparing version 0.8.2-alpha to 0.8.3-alpha
@@ -8,3 +8,5 @@ export declare enum APIValidationState { | ||
User = "ROLE_USER", | ||
Admin = "ROLE_ADMIN" | ||
Admin = "ROLE_ADMIN", | ||
Moderator = "ROLE_MODERATOR", | ||
SuperAdmin = "ROLE_SUPER_ADMIN" | ||
} | ||
@@ -11,0 +13,0 @@ export interface APIAttachmentData { |
@@ -12,3 +12,5 @@ // Enums | ||
APIUserRole["Admin"] = "ROLE_ADMIN"; | ||
APIUserRole["Moderator"] = "ROLE_MODERATOR"; | ||
APIUserRole["SuperAdmin"] = "ROLE_SUPER_ADMIN"; | ||
})(APIUserRole || (APIUserRole = {})); | ||
//# sourceMappingURL=api.js.map |
@@ -22,2 +22,5 @@ import Base from "./Base"; | ||
constructor(client: Client, data: APIUserData); | ||
get isSuperAdmin(): boolean; | ||
get isAdmin(): boolean; | ||
get isModerator(): boolean; | ||
_patch(data: APIUserData): void; | ||
@@ -24,0 +27,0 @@ /** Return data for api request */ |
import { __extends } from "tslib"; | ||
import Base from "./Base"; | ||
import UserResourceManager from "../managers/UserResourceManager"; | ||
import { APIUserRole } from "../@types"; | ||
/** Represents an user */ | ||
@@ -18,2 +19,27 @@ var User = /** @class */ (function (_super) { | ||
} | ||
Object.defineProperty(User.prototype, "isSuperAdmin", { | ||
get: function () { | ||
return this.roles.includes(APIUserRole.SuperAdmin); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(User.prototype, "isAdmin", { | ||
get: function () { | ||
if (this.isSuperAdmin) | ||
return this.isSuperAdmin; | ||
return this.roles.includes(APIUserRole.Admin); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(User.prototype, "isModerator", { | ||
get: function () { | ||
if (this.isAdmin) | ||
return this.isAdmin; | ||
return this.roles.includes(APIUserRole.Moderator); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
User.prototype._patch = function (data) { | ||
@@ -20,0 +46,0 @@ this.data = data; |
{ | ||
"name": "rr-apilib", | ||
"version": "0.8.2-alpha", | ||
"version": "0.8.3-alpha", | ||
"description": "Library for interact with RR-API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
187766
2768