mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Added ability for ystem admin to disable registration.
This commit is contained in:
parent
45b78101c8
commit
bc8df48389
10 changed files with 145 additions and 32 deletions
|
|
@ -12,23 +12,47 @@ SysConfig.allow({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.noSysAdminReg' () {
|
||||
return SysConfig.insert({
|
||||
canReg: false,
|
||||
dateAdded: new Date(),
|
||||
});
|
||||
},
|
||||
'edit.noSysAdminReg' (canReg) {
|
||||
check(canReg, Boolean);
|
||||
'add.noSysAdminReg' (admReg, genReg) {
|
||||
check(admReg, Boolean);
|
||||
check(genReg, Boolean);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('Not able to change registration setting. Make sure you are logged in with valid system administrator credentials.');
|
||||
}
|
||||
|
||||
let curr = SysConfig.findOne({});
|
||||
if (typeof curr != 'undefined') {
|
||||
let configId = curr._id;
|
||||
Meteor.call('edit.noSysAdminReg', configId, admReg, genReg, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR updating sys admin reg: " + err);
|
||||
} else {
|
||||
console.log("Success updating sys admin reg.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return SysConfig.insert({
|
||||
SysAdminReg: admReg,
|
||||
dateAdded: new Date(),
|
||||
allowReg: genReg,
|
||||
});
|
||||
}
|
||||
},
|
||||
'edit.noSysAdminReg' (configId, canReg, genReg) {
|
||||
check(canReg, Boolean);
|
||||
check(configId, String);
|
||||
check(genReg, Boolean);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('Not able to change registration setting. Make sure you are logged in with valid system administrator credentials.');
|
||||
}
|
||||
|
||||
return SysConfig.update({ _id: configId }, {
|
||||
$set: {
|
||||
canReg: canReg,
|
||||
SysAdminReg: canReg,
|
||||
allowReg: genReg,
|
||||
dateUpdated: new Date(),
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
@ -12,23 +12,6 @@ UserConfigOptions.allow({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.darkPref' (darkPref) {
|
||||
check(darkPref, Boolean);
|
||||
|
||||
return UserConfigOptions.insert({
|
||||
darkPref: darkPref,
|
||||
owner: this.userId
|
||||
});
|
||||
},
|
||||
'edit.darkPref' (darkPref) {
|
||||
check(darkPref, Boolean);
|
||||
|
||||
return UserConfigOptions.update({ owner: this.userId }, {
|
||||
$set: {
|
||||
darkPref: darkPref
|
||||
}
|
||||
});
|
||||
},
|
||||
'change.userPass' (usersId, password) {
|
||||
check(usersId, String);
|
||||
check(password, String);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue