wekan/models/accountSettings.js
nztqa 6a10257fd7 Add change email address
Set allow email change in admin panel
2017-08-07 17:40:50 +09:00

33 lines
594 B
JavaScript

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,
},
});
});
}