[omd-commits] OMD Git: omd: Added multisite class

git version control git at mathias-kettner.de
Wed May 30 09:39:26 CEST 2012


Module:   omd
Branch:   master
Commit:   2e6aef73be73da2b0f176490fc345c9238d3f83b
URL:      http://omdistro.org/projects/omd/repository/revisions/2e6aef73be73da2b0f176490fc345c9238d3f83b

Author:   Bastian Kuhn <bk at mathias-kettner.de>
Date:     Wed May 30 09:39:20 2012 +0200
Commiter: Bastian Kuhn <bk at mathias-kettner.de>
Date:     Wed May 30 09:39:20 2012 +0200

Added multisite class

---

 packages/dokuwiki/multisite.class.php |   70 +++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/packages/dokuwiki/multisite.class.php b/packages/dokuwiki/multisite.class.php
new file mode 100644
index 0000000..77352c0
--- /dev/null
+++ b/packages/dokuwiki/multisite.class.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * auth/multisite.class.php
+ *
+ * Login against the Check_MK Multisite API 
+ *
+ * @author    Bastian Kuhn <bk at mathias-kettner.de>
+ */
+
+class auth_multisite extends auth_basic {
+
+  var $success = true;
+  var $cando = array (
+    'addUser'     => false, // can Users be created?
+    'delUser'     => false, // can Users be deleted?
+    'modLogin'    => false, // can login names be changed?
+    'modPass'     => false, // can passwords be changed?
+    'modName'     => false, // can real names be changed?
+    'modMail'     => false, // can emails be changed?
+    'modGroups'   => false, // can groups be changed?
+    'getUsers'    => false, // can a (filtered) list of users be retrieved?
+    'getUserCount'=> false, // can the number of users be retrieved?
+    'getGroups'   => false, // can a list of available groups be retrieved?
+    'external'    => true, // does the module do external auth checking?
+    'logout'      => false,  // can the user logout again? (eg. not possible with HTTP auth)
+  );
+
+  function auth_basic() {
+  }
+
+
+  function trustExternal($user,$pass,$sticky=false){
+      global $conf;
+      global $USERINFO;
+      foreach(array_keys($_COOKIE) AS $cookieName) 
+      {
+        if(substr($cookieName, 0, 5) != 'auth_'){ 
+           continue;
+        }
+
+        if(!isset($_COOKIE[$cookieName]) || $_COOKIE[$cookieName] == ''){
+            continue;
+        }
+        list($username, $issueTime, $cookieHash) = explode(':', $_COOKIE[$cookieName], 3);
+
+        require_once($conf['multisite']['authfile']);
+        if(!isset($mk_users[$username])){
+            continue;
+        }
+        $secret = trim(file_get_contents($conf['multisite']['auth_secret']));
+        if(md5($username . $issueTime . $mk_users[$username]['password'] . $secret) == $cookieHash)
+        {
+            $USERINFO['name'] = $username;
+            $USERINFO['grps'] = $mk_users[$username]['roles'];
+            $_SERVER['REMOTE_USER'] = $username;
+            $_SESSION[DOKU_COOKIE]['auth']['user'] = $username;
+            $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
+            return true;
+        }else
+        {
+            continue;
+        }
+      }
+      header('Location:../check_mk/login.py?_origtarget=' . $_SERVER['REQUEST_URI']);
+      return false;
+  }
+
+
+}
+//Setup VIM: ex: et ts=2 :



More information about the omd-commits mailing list