Not sure if everyone like this, but for my use, I find it useful. When you use external auth, grant admin privileges regardless of what is in the DB if the user login is 'admin'. This way, you don't have to manually alter (or add in advance) the user. With external auth, it's quite usual to have a super user called admin.

--
Daniel Berteaud
FIREWALL-SERVICES SARL.
Société de Services en Logiciels Libres
Technopôle Montesquieu
33650 MARTILLAC
Tel : 05 56 64 15 32
Fax : 05 56 64 15 32
Web : http://www.firewall-services.com

diff -Nur -x '*.orig' -x '*.rej' dl-0.11/htdocs/include/admfuncs.php mezzanine_patched_dl-0.11/htdocs/include/admfuncs.php
--- dl-0.11/htdocs/include/admfuncs.php	2013-07-04 14:44:22.000000000 +0200
+++ mezzanine_patched_dl-0.11/htdocs/include/admfuncs.php	2013-11-18 22:53:06.316508064 +0100
@@ -250,6 +250,8 @@
     . " LEFT JOIN role r ON r.id = u.role_id"
     . " WHERE u.name = " . $db->quote($user);
   $DATA = $db->query($sql)->fetch();
+  if ($user == 'admin')
+    $DATA["admin"] = true;
 
   // remote auth doesn't check pass, but still needs an id stub
   if($rmt)
@@ -268,6 +270,8 @@
       $sql .= " LEFT JOIN role r ON r.id = u.role_id";
       $sql .= " WHERE u.name = " . $db->quote($user);
       $DATA = $db->query($sql)->fetch();
+      if ($user == 'admin')
+        $DATA["admin"] = true;
     }
 
     return $DATA;

Reply via email to