summaryrefslogtreecommitdiffstats
path: root/models/users.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/users.js')
-rw-r--r--models/users.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/models/users.js b/models/users.js
index 1adb4a57..55d85e07 100644
--- a/models/users.js
+++ b/models/users.js
@@ -258,9 +258,14 @@ Users.attachSchema(
);
Users.allow({
- update(userId) {
- const user = Users.findOne(userId);
- return user && Meteor.user().isAdmin; // GitHub issue #2590
+ update(userId, doc) {
+ const user = Users.findOne({ _id: userId });
+ if ((user && user.isAdmin) || (Meteor.user() && Meteor.user().isAdmin))
+ return true;
+ if (!user) {
+ return false;
+ }
+ return doc._id === userId;
},
remove(userId, doc) {
const adminsNumber = Users.find({ isAdmin: true }).count();