1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

hopefully fixed the privilege problems

--HG--
extra : rebase_source : 9826d20176134a53ff232816a10407465d8c0f50
This commit is contained in:
Perttu Ahola 2011-05-29 22:34:04 +03:00
parent e8b8ed0280
commit e81919c818
6 changed files with 72 additions and 22 deletions

View file

@ -35,7 +35,8 @@ void cmd_privs(std::wostringstream &os,
{
// Show our own real privs, without any adjustments
// made for admin status
os<<L"-!- " + narrow_to_wide(privsToString(ctx->player->privs));
os<<L"-!- " + narrow_to_wide(privsToString(
ctx->server->getPlayerAuthPrivs(ctx->player->getName())));
return;
}
@ -52,7 +53,7 @@ void cmd_privs(std::wostringstream &os,
return;
}
os<<L"-!- " + narrow_to_wide(privsToString(tp->privs));
os<<L"-!- " + narrow_to_wide(privsToString(ctx->server->getPlayerAuthPrivs(tp->getName())));
}
void cmd_grantrevoke(std::wostringstream &os,
@ -83,14 +84,19 @@ void cmd_grantrevoke(std::wostringstream &os,
os<<L"-!- No such player";
return;
}
std::string playername = wide_to_narrow(ctx->parms[1]);
u64 privs = ctx->server->getPlayerAuthPrivs(playername);
if(ctx->parms[0] == L"grant")
tp->privs |= newprivs;
privs |= newprivs;
else
tp->privs &= ~newprivs;
privs &= ~newprivs;
ctx->server->setPlayerAuthPrivs(playername, privs);
os<<L"-!- Privileges change to ";
os<<narrow_to_wide(privsToString(tp->privs));
os<<narrow_to_wide(privsToString(privs));
}
void cmd_time(std::wostringstream &os,