forked from Mirrorlandia_minetest/minetest
Rename "build" privilege to "interact" (backwards-compatibly, of course)
This commit is contained in:
parent
69bc9224db
commit
932988af46
12
src/auth.cpp
12
src/auth.cpp
@ -28,8 +28,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
std::set<std::string> privsToSet(u64 privs)
|
std::set<std::string> privsToSet(u64 privs)
|
||||||
{
|
{
|
||||||
std::set<std::string> s;
|
std::set<std::string> s;
|
||||||
if(privs & PRIV_BUILD)
|
if(privs & PRIV_INTERACT)
|
||||||
s.insert("build");
|
s.insert("interact");
|
||||||
if(privs & PRIV_TELEPORT)
|
if(privs & PRIV_TELEPORT)
|
||||||
s.insert("teleport");
|
s.insert("teleport");
|
||||||
if(privs & PRIV_SETTIME)
|
if(privs & PRIV_SETTIME)
|
||||||
@ -52,8 +52,8 @@ std::set<std::string> privsToSet(u64 privs)
|
|||||||
std::string privsToString(u64 privs)
|
std::string privsToString(u64 privs)
|
||||||
{
|
{
|
||||||
std::ostringstream os(std::ios_base::binary);
|
std::ostringstream os(std::ios_base::binary);
|
||||||
if(privs & PRIV_BUILD)
|
if(privs & PRIV_INTERACT)
|
||||||
os<<"build,";
|
os<<"interact,";
|
||||||
if(privs & PRIV_TELEPORT)
|
if(privs & PRIV_TELEPORT)
|
||||||
os<<"teleport,";
|
os<<"teleport,";
|
||||||
if(privs & PRIV_SETTIME)
|
if(privs & PRIV_SETTIME)
|
||||||
@ -89,7 +89,9 @@ u64 stringToPrivs(std::string str)
|
|||||||
{
|
{
|
||||||
std::string s = trim(f.next(","));
|
std::string s = trim(f.next(","));
|
||||||
if(s == "build")
|
if(s == "build")
|
||||||
privs |= PRIV_BUILD;
|
privs |= PRIV_INTERACT;
|
||||||
|
else if(s == "interact")
|
||||||
|
privs |= PRIV_INTERACT;
|
||||||
else if(s == "teleport")
|
else if(s == "teleport")
|
||||||
privs |= PRIV_TELEPORT;
|
privs |= PRIV_TELEPORT;
|
||||||
else if(s == "settime")
|
else if(s == "settime")
|
||||||
|
@ -31,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
// of the player, and define things they're allowed to do. See also
|
// of the player, and define things they're allowed to do. See also
|
||||||
// the static methods Player::privsToString and stringToPrivs that
|
// the static methods Player::privsToString and stringToPrivs that
|
||||||
// convert these to human-readable form.
|
// convert these to human-readable form.
|
||||||
const u64 PRIV_BUILD = 1; // Can build - i.e. modify the world
|
const u64 PRIV_INTERACT = 1; // Can interact
|
||||||
const u64 PRIV_TELEPORT = 2; // Can teleport
|
const u64 PRIV_TELEPORT = 2; // Can teleport
|
||||||
const u64 PRIV_SETTIME = 4; // Can set the time
|
const u64 PRIV_SETTIME = 4; // Can set the time
|
||||||
const u64 PRIV_PRIVS = 8; // Can grant and revoke privileges
|
const u64 PRIV_PRIVS = 8; // Can grant and revoke privileges
|
||||||
@ -46,7 +46,7 @@ const u64 PRIV_PASSWORD = 256; // Can set other players' passwords
|
|||||||
// Default privileges - these can be overriden for new players using the
|
// Default privileges - these can be overriden for new players using the
|
||||||
// config option "default_privs" - however, this value still applies for
|
// config option "default_privs" - however, this value still applies for
|
||||||
// players that existed before the privileges system was added.
|
// players that existed before the privileges system was added.
|
||||||
const u64 PRIV_DEFAULT = PRIV_BUILD|PRIV_SHOUT;
|
const u64 PRIV_DEFAULT = PRIV_INTERACT|PRIV_SHOUT;
|
||||||
const u64 PRIV_ALL = 0x7FFFFFFFFFFFFFFFULL;
|
const u64 PRIV_ALL = 0x7FFFFFFFFFFFFFFFULL;
|
||||||
const u64 PRIV_INVALID = 0x8000000000000000ULL;
|
const u64 PRIV_INVALID = 0x8000000000000000ULL;
|
||||||
|
|
||||||
|
@ -2381,7 +2381,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
}
|
}
|
||||||
else if(command == TOSERVER_SIGNNODETEXT)
|
else if(command == TOSERVER_SIGNNODETEXT)
|
||||||
{
|
{
|
||||||
if((getPlayerPrivs(player) & PRIV_BUILD) == 0)
|
if((getPlayerPrivs(player) & PRIV_INTERACT) == 0)
|
||||||
return;
|
return;
|
||||||
/*
|
/*
|
||||||
u16 command
|
u16 command
|
||||||
@ -2562,7 +2562,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
|
|
||||||
// Disallow moving items in elsewhere than player's inventory
|
// Disallow moving items in elsewhere than player's inventory
|
||||||
// if not allowed to build
|
// if not allowed to build
|
||||||
if((getPlayerPrivs(player) & PRIV_BUILD) == 0
|
if((getPlayerPrivs(player) & PRIV_INTERACT) == 0
|
||||||
&& (ma->from_inv != "current_player"
|
&& (ma->from_inv != "current_player"
|
||||||
|| ma->to_inv != "current_player"))
|
|| ma->to_inv != "current_player"))
|
||||||
{
|
{
|
||||||
@ -2628,7 +2628,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
{
|
{
|
||||||
IDropAction *da = (IDropAction*)a;
|
IDropAction *da = (IDropAction*)a;
|
||||||
// Disallow dropping items if not allowed to build
|
// Disallow dropping items if not allowed to build
|
||||||
if((getPlayerPrivs(player) & PRIV_BUILD) == 0)
|
if((getPlayerPrivs(player) & PRIV_INTERACT) == 0)
|
||||||
{
|
{
|
||||||
delete a;
|
delete a;
|
||||||
return;
|
return;
|
||||||
@ -2976,7 +2976,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
/*
|
/*
|
||||||
Make sure the player is allowed to do it
|
Make sure the player is allowed to do it
|
||||||
*/
|
*/
|
||||||
bool build_priv = (getPlayerPrivs(player) & PRIV_BUILD) != 0;
|
bool build_priv = (getPlayerPrivs(player) & PRIV_INTERACT) != 0;
|
||||||
if(!build_priv)
|
if(!build_priv)
|
||||||
{
|
{
|
||||||
infostream<<"Ignoring interaction from player "<<player->getName()
|
infostream<<"Ignoring interaction from player "<<player->getName()
|
||||||
|
Loading…
Reference in New Issue
Block a user