From d509ca03b22842116ebd197931fdcf509aef2108 Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 7 Oct 2022 13:19:06 +1000 Subject: Allow gods to reject account requests. Also disable and ban bits, though not fully implemented. --- src/sledjchisl/sledjchisl.c | 54 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index c02cba9..64ae6a3 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -5918,6 +5918,8 @@ static void accountWrite(reqData *Rd) if (!writeLuaString (Rd, fd, file, "vouched", "off")) goto notWritten; if (!writeLuaString (Rd, fd, file, "voucher", NULL)) goto notWritten; if (!writeLuaString (Rd, fd, file, "approver", NULL)) goto notWritten; + if (!writeLuaString (Rd, fd, file, "banner", NULL)) goto notWritten; + if (!writeLuaString (Rd, fd, file, "reason", NULL)) goto notWritten; if (!writeLuaString (Rd, fd, file, "link", link)) goto notWritten; l = strlen(end); if (l != writeall(fd, end, l)) @@ -7078,6 +7080,8 @@ static void accountViewWeb(reqData *Rd, inputForm *oF, inputValue *oV) *email = getStrH(Rd->database, "UserAccounts.Email"), *voucher = getStrH(Rd->database, "Lua.voucher"), *approver = getStrH(Rd->database, "Lua.approver"), + *banner = getStrH(Rd->database, "Lua.banner"), + *reason = getStrH(Rd->database, "Lua.reason"), *about = getStrH(Rd->database, "Lua.aboutMe"); time_t crtd = atol(getStrH(Rd->database, "UserAccounts.Created")); @@ -7091,6 +7095,8 @@ static void accountViewWeb(reqData *Rd, inputForm *oF, inputValue *oV) Rd->reply->addstrf(Rd->reply, "

UUID : %s

", getStrH(Rd->database, "UserAccounts.PrincipalID")); Rd->reply->addstrf(Rd->reply, "

Voucher : %s

", voucher); Rd->reply->addstrf(Rd->reply, "

Approver : %s

", approver); + Rd->reply->addstrf(Rd->reply, "

Banner : %s

", banner); + Rd->reply->addstrf(Rd->reply, "

Reason : %s

", reason); HTMLtextArea(Rd->reply, "aboutMe", "About", 7, 50, 4, 16384, "", "off", "true", "soft", about, FALSE, TRUE); accountWebSubs(Rd, oF); accountWebFooter(Rd, oF); @@ -7103,6 +7109,8 @@ static void accountEditWeb(reqData *Rd, inputForm *oF, inputValue *oV) *email = getStrH(Rd->database, "UserAccounts.Email"), *voucher = getStrH(Rd->database, "Lua.voucher"), *approver = getStrH(Rd->database, "Lua.approver"), + *banner = getStrH(Rd->database, "Lua.banner"), + *reason = getStrH(Rd->database, "Lua.reason"), *about = getStrH(Rd->database, "Lua.aboutMe"), *lvl = getLevel(atoi(level)); short lv = atoi(level); @@ -7119,11 +7127,13 @@ static void accountEditWeb(reqData *Rd, inputForm *oF, inputValue *oV) HTMLtextArea(Rd->reply, "aboutMe", "About", 7, 50, 4, 16384, "", "off", "true", "soft", about, FALSE, TRUE); Rd->reply->addstrf(Rd->reply, "

Voucher : %s

", voucher); - if (200 <= Rd->shs.level) + if (200 <= Rd->shs.level) // Only gods can change level for accounts. { qlisttbl_obj_t obj; HTMLhidden(Rd->reply, "approver", approver); + HTMLhidden(Rd->reply, "banner", banner); + HTMLhidden(Rd->reply, "reason", reason); HTMLselect(Rd->reply, "level", "level"); memset((void*)&obj, 0, sizeof(obj)); // must be cleared before call accountLevels->lock(accountLevels); @@ -7135,14 +7145,25 @@ static void accountEditWeb(reqData *Rd, inputForm *oF, inputValue *oV) if (strcmp(lvl, (char *) obj.data) == 0) is = true; -// if ((is) || ((l <= Rd->shs.level) && (l != -200) && (l != -100) && (l != -50))) // Not above our pay grade, not newbie, validated, nor vouched for. - if ((is) || ((l <= Rd->shs.level) && (lv <= l))) // As per discussions, can't lower level. Do that in the console. +/* "-256", "banned"); + "-240", "rejected"); + "-230", "disabled"); + "-200", "newbie"); + "-100", "validated"); + "-50", "vouched for"); + "0", "approved"); // Note that http://opensimulator.org/wiki/Userlevel claims that 1 and above are "GOD_LIKE". + "200", "god"); +*/ + if ((is) || ((l <= Rd->shs.level) && (l != -200) && (l != -100) && (l != -50) && (strcmp("-256", (char *) obj.name) != 0) )) // Not above our pay grade, not newbie, validated, nor vouched for. Also skip banned. +// if ((is) || ((l <= Rd->shs.level) && (lv <= l))) // As per discussions, can't lower level. Do that in the console. NOTE: No one can recall those discussions. lol HTMLoption(Rd->reply, (char *) obj.data, is); } accountLevels->unlock(accountLevels); HTMLselectEnd(Rd->reply); Rd->reply->addstrf(Rd->reply, "

"); + Rd->reply->addstrf(Rd->reply, "
banned
Account was banned.
"); + Rd->reply->addstrf(Rd->reply, "
rejected
New account was rejected.
"); Rd->reply->addstrf(Rd->reply, "
disabled
Account cannot log in anywhere.
"); Rd->reply->addstrf(Rd->reply, "
newbie
Newly created account, not yet validated.
"); Rd->reply->addstrf(Rd->reply, "
validated
Newly created account, they have clicked on the validation link in their validation email.
"); @@ -7298,6 +7319,8 @@ V("Found Lua record."); Rd->database->putstr(Rd->database, "Lua.vouched", getStrH(tnm, "vouched")); Rd->database->putstr(Rd->database, "Lua.voucher", getStrH(tnm, "voucher")); Rd->database->putstr(Rd->database, "Lua.approver", getStrH(tnm, "approver")); + Rd->database->putstr(Rd->database, "Lua.banner", getStrH(tnm, "banner")); + Rd->database->putstr(Rd->database, "Lua.reason", getStrH(tnm, "reason")); } // else if (rows) if (rows) @@ -7492,8 +7515,23 @@ static int accountSaveSub(reqData *Rd, inputForm *iF, inputValue *iV) { if (200 <= Rd->shs.level) { - I("%s %s approved by %s.", getStrH(Rd->database, "UserAccounts.FirstName"), getStrH(Rd->database, "UserAccounts.LastName"), Rd->shs.name); - Rd->stuff->putstr(Rd->stuff, "approver", Rd->shs.name); + if (strcmp("0", lvl) == 0) + { + I("%s %s approved by %s.", getStrH(Rd->database, "UserAccounts.FirstName"), getStrH(Rd->database, "UserAccounts.LastName"), Rd->shs.name); + Rd->stuff->putstr(Rd->stuff, "approver", Rd->shs.name); + } + else if (strcmp("-240", lvl) == 0) + { + I("%s %s rejected by %s.", getStrH(Rd->database, "UserAccounts.FirstName"), getStrH(Rd->database, "UserAccounts.LastName"), Rd->shs.name); + Rd->stuff->putstr(Rd->stuff, "approver", Rd->shs.name); + } + else if (strcmp("-256", lvl) == 0) + { + I("%s %s banned by %s.", getStrH(Rd->database, "UserAccounts.FirstName"), getStrH(Rd->database, "UserAccounts.LastName"), Rd->shs.name); + Rd->stuff->putstr(Rd->stuff, "banner", Rd->shs.name); + } + else + I("%s %s changed to %s by %s.", getStrH(Rd->database, "UserAccounts.FirstName"), getStrH(Rd->database, "UserAccounts.LastName"), lvl, Rd->shs.name); } else { @@ -7564,6 +7602,8 @@ static int accountValidateSub(reqData *Rd, inputForm *iF, inputValue *iV) Rd->stuff->putstr(Rd->stuff, "vouched", getStrH(Rd->database, "Lua.vouched")); Rd->stuff->putstr(Rd->stuff, "voucher", getStrH(Rd->database, "Lua.voucher")); Rd->stuff->putstr(Rd->stuff, "approver", getStrH(Rd->database, "Lua.approver")); + Rd->stuff->putstr(Rd->stuff, "banner", getStrH(Rd->database, "Lua.banner")); + Rd->stuff->putstr(Rd->stuff, "reason", getStrH(Rd->database, "Lua.reason")); Rd->shs.level = -100; Rd->database->putstr(Rd->database, "UserAccounts.UserLevel", "-100"); accountWrite(Rd); @@ -8004,7 +8044,9 @@ void account_html(char *file, reqData *Rd, HTMLfile *thisFile) if (NULL == accountLevels) { accountLevels = qlisttbl(QLISTTBL_LOOKUPFORWARD | QLISTTBL_THREADSAFE | QLISTTBL_UNIQUE); - accountLevels->putstr(accountLevels, "-256", "disabled"); + accountLevels->putstr(accountLevels, "-256", "banned"); + accountLevels->putstr(accountLevels, "-240", "rejected"); + accountLevels->putstr(accountLevels, "-230", "disabled"); accountLevels->putstr(accountLevels, "-200", "newbie"); accountLevels->putstr(accountLevels, "-100", "validated"); accountLevels->putstr(accountLevels, "-50", "vouched for"); -- cgit v1.1