Demo mode: the profiles must be in read-only mode (it is not enough to have the users in read-only)

SVN:trunk[3203]
This commit is contained in:
Romain Quetiez
2014-06-10 11:50:20 +00:00
parent 8141f8c619
commit f89792e171

View File

@@ -210,6 +210,25 @@ class URP_Profiles extends UserRightsBaseClassGUI
$oLnk->DBDelete();
}
}
/**
* Returns the set of flags (OPT_ATT_HIDDEN, OPT_ATT_READONLY, OPT_ATT_MANDATORY...)
* for the given attribute in the current state of the object
* @param $sAttCode string $sAttCode The code of the attribute
* @param $aReasons array To store the reasons why the attribute is read-only (info about the synchro replicas)
* @param $sTargetState string The target state in which to evalutate the flags, if empty the current state will be used
* @return integer Flags: the binary combination of the flags applicable to this attribute
*/
public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '')
{
$iFlags = parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState);
if (MetaModel::GetConfig()->Get('demo_mode'))
{
$aReasons[] = 'Sorry, profiles are read-only in the demonstration mode!';
$iFlags |= OPT_ATT_READONLY;
}
return $iFlags;
}
}