Changeset:
        4269cec9ef42
        
https://sourceforge.net/p/mrbs/hg-code/ci/4269cec9ef4241365076649d878fd683feadd617
Author:
        Campbell Morrison <[email protected]>
Date:
        Sat Oct 29 09:02:35 2016 +0100
Log message:

Simplified code

diffstat:

 web/auth/auth_joomla.inc |  32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)

diffs (47 lines):

diff -r 128582afd203 -r 4269cec9ef42 web/auth/auth_joomla.inc
--- a/web/auth/auth_joomla.inc  Fri Oct 28 12:41:10 2016 +0100
+++ b/web/auth/auth_joomla.inc  Sat Oct 29 09:02:35 2016 +0100
@@ -27,31 +27,23 @@
   $authorised_levels = $user->getAuthorisedViewLevels();
   
   // Check if they have manager access
-  if (is_array($auth['joomla']['admin_access_levels']))
+  if (isset($auth['joomla']['admin_access_levels']))
   {
-    $admin_levels = $auth['joomla']['admin_access_levels'];
-  }
-  else
-  {
-    $admin_levels = array($auth['joomla']['admin_access_levels']);
-  }
-  if (count(array_intersect($authorised_levels, $admin_levels)) > 0)
-  {
-    return 2;
+    $admin_levels = (array)$auth['joomla']['admin_access_levels'];
+    if (count(array_intersect($authorised_levels, $admin_levels)) > 0)
+    {
+      return 2;
+    }
   }
   
   // Check if they have user access
-  if (is_array($auth['joomla']['user_access_levels']))
+  if (isset($auth['joomla']['user_access_levels']))
   {
-    $user_levels = $auth['joomla']['user_access_levels'];
-  }
-  else
-  {
-    $user_levels = array($auth['joomla']['user_access_levels']);
-  }
-  if (count(array_intersect($authorised_levels, $user_levels)) > 0)
-  {
-    return 1;
+    $user_levels = (array)$auth['joomla']['user_access_levels'];
+    if (count(array_intersect($authorised_levels, $user_levels)) > 0)
+    {
+      return 1;
+    }
   }
 
   // Everybody else is access level '0'

------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to