- AbitaregliIblei.it
- Server aggiornamenti agli script. - Editor HTML corretto un po'. - Record Mysql per server (appena iniziato)
This commit is contained in:
@@ -672,6 +672,16 @@ UserSchema.statics.isManagerById = async function (id) {
|
||||
}
|
||||
};
|
||||
|
||||
UserSchema.statics.isAdminById = async function (id) {
|
||||
try {
|
||||
const ris = await User.findOne({ _id: id }, { perm: 1 }).lean();
|
||||
return ((ris.perm & shared_consts.Permissions.Admin) ===
|
||||
shared_consts.Permissions.Admin);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
UserSchema.statics.isEditor = function (perm) {
|
||||
try {
|
||||
return ((perm & shared_consts.Permissions.Editor) ===
|
||||
@@ -3237,7 +3247,7 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
||||
}
|
||||
|
||||
ris = true;
|
||||
// } else if ((cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) || (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE)) {
|
||||
// } else if ((cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) || (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE)) {
|
||||
// Before to accept, I see if it's already set !
|
||||
|
||||
/*outres = {
|
||||
@@ -5742,10 +5752,10 @@ UserSchema.statics.tooManyLoginWrong = async function (idapp, username, set) {
|
||||
|
||||
await User.findOneAndUpdate({ _id: user._id }, { $set: { retry_pwd: user.retry_pwd } });
|
||||
}
|
||||
return {troppilogin: user.retry_pwd > maxnum, retry_pwd: user.retry_pwd};
|
||||
return { troppilogin: user.retry_pwd > maxnum, retry_pwd: user.retry_pwd };
|
||||
}
|
||||
|
||||
return {troppilogin: false, retry_pwd: 0};
|
||||
return { troppilogin: false, retry_pwd: 0 };
|
||||
};
|
||||
|
||||
UserSchema.statics.setLastCircuitOpened = async function (idapp, username, circuitpath) {
|
||||
|
||||
Reference in New Issue
Block a user