[FIXED] Holding the @setenv restriction isn't preventing other objects from changing the environment settings

master
Kitty Barnett 2020-11-21 23:04:53 +01:00
parent c326edb942
commit 43bd5d8303
3 changed files with 12 additions and 4 deletions

View File

@ -366,9 +366,11 @@ bool RlvActions::isLocalTp(const LLVector3d& posGlobal)
// WindLight
//
bool RlvActions::canChangeEnvironment()
bool RlvActions::canChangeEnvironment(const LLUUID& idRlvObject)
{
return !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV);
// User can (partially) change their environment settings if:
// - not specifically restricted from changing their environment (by any object other than the one specified)
return (idRlvObject.isNull()) ? !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV) : !gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETENV, idRlvObject);
}
// ============================================================================

View File

@ -218,9 +218,9 @@ public:
// =========
public:
/*
* Returns true if the user can make changes to their WindLight environment
* Returns true if the user can make changes to their WindLight environment
*/
static bool canChangeEnvironment();
static bool canChangeEnvironment(const LLUUID& idRlvObject = LLUUID::null);
// =================

View File

@ -502,6 +502,12 @@ bool RlvEnvironment::onHandleCommand(const RlvCommand& rlvCmd, ERlvCmdRet& cmdRe
{
if ( (rlvCmd.getBehaviour().length() > strCmdPrefix.length() + 2) && (boost::starts_with(rlvCmd.getBehaviour(), strCmdPrefix)) )
{
if ( (RLV_TYPE_FORCE == rlvCmd.getParamType()) && (!RlvActions::canChangeEnvironment(rlvCmd.getObjectID())) )
{
cmdRet = RLV_RET_FAILED_LOCK;
return true;
}
std::string strEnvCommand = rlvCmd.getBehaviour().substr(strCmdPrefix.length());
handler_map_t::const_iterator itFnEntry = fnLookup.find(strEnvCommand);