Ver código fonte

N.523 UserRights::ListProfiles must return an empty array if nobody is currently logged in (instead of a FATAL ERROR).

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4478 a333f486-631f-4898-b8df-5754b55c2be0
romainq 8 anos atrás
pai
commit
41a3a03a0b
1 arquivos alterados com 6 adições e 1 exclusões
  1. 6 1
      core/userrights.class.inc.php

+ 6 - 1
core/userrights.class.inc.php

@@ -1045,7 +1045,12 @@ class UserRights
 		{
 			$oUser = self::$m_oUser;
 		}
-		if ($oUser->GetKey() == self::$m_oUser->GetKey())
+		if ($oUser === null)
+		{
+			// Not logged in: no profile at all
+			$aProfiles = array();
+		}
+		elseif ((self::$m_oUser !== null) && ($oUser->GetKey() == self::$m_oUser->GetKey()))
 		{
 			// Data about the current user can be found into the session data
 			if (array_key_exists('profile_list', $_SESSION))