aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/user.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/user.js')
-rw-r--r--server/models/user.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/models/user.js b/server/models/user.js
index e64bab8ab..8f9c2bf65 100644
--- a/server/models/user.js
+++ b/server/models/user.js
@@ -79,7 +79,8 @@ module.exports = function (sequelize, DataTypes) {
79 }, 79 },
80 instanceMethods: { 80 instanceMethods: {
81 isPasswordMatch, 81 isPasswordMatch,
82 toFormatedJSON 82 toFormatedJSON,
83 isAdmin
83 }, 84 },
84 hooks: { 85 hooks: {
85 beforeCreate: beforeCreateOrUpdate, 86 beforeCreate: beforeCreateOrUpdate,
@@ -117,6 +118,11 @@ function toFormatedJSON () {
117 createdAt: this.createdAt 118 createdAt: this.createdAt
118 } 119 }
119} 120}
121
122function isAdmin () {
123 return this.role === constants.USER_ROLES.ADMIN
124}
125
120// ------------------------------ STATICS ------------------------------ 126// ------------------------------ STATICS ------------------------------
121 127
122function associate (models) { 128function associate (models) {