diff options
author | nztqa <nztqa@users.noreply.github.com> | 2017-08-07 17:40:50 +0900 |
---|---|---|
committer | nztqa <nztqa@users.noreply.github.com> | 2017-08-07 17:40:50 +0900 |
commit | 6a10257fd7230d08d9a64fc4877e85972375498d (patch) | |
tree | 263bed8ce542bda6f31f09eb521362c76b3c3440 /models/accountSettings.js | |
parent | 57219df16afbc0c512e15ed9801308591b41d318 (diff) | |
download | wekan-6a10257fd7230d08d9a64fc4877e85972375498d.tar.gz wekan-6a10257fd7230d08d9a64fc4877e85972375498d.tar.bz2 wekan-6a10257fd7230d08d9a64fc4877e85972375498d.zip |
Add change email address
Set allow email change in admin panel
Diffstat (limited to 'models/accountSettings.js')
-rw-r--r-- | models/accountSettings.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/models/accountSettings.js b/models/accountSettings.js new file mode 100644 index 00000000..db4087c0 --- /dev/null +++ b/models/accountSettings.js @@ -0,0 +1,33 @@ +AccountSettings = new Mongo.Collection('accountSettings'); + +AccountSettings.attachSchema(new SimpleSchema({ + _id: { + type: String, + }, + booleanValue: { + type: Boolean, + optional: true, + }, + sort: { + type: Number, + decimal: true, + }, +})); + +AccountSettings.allow({ + update(userId) { + const user = Users.findOne(userId); + return user && user.isAdmin; + }, +}); + +if (Meteor.isServer) { + Meteor.startup(() => { + AccountSettings.upsert({ _id: 'accounts-allowEmailChange' }, { + $setOnInsert: { + booleanValue: false, + sort: 0, + }, + }); + }); +} |