diff -Nur -x '*.orig' -x '*.rej' openupload-0.4.2/lib/main.inc.php mezzanine_patched_openupload-0.4.2/lib/main.inc.php --- openupload-0.4.2/lib/main.inc.php 2010-11-20 11:39:47.000000000 +0100 +++ mezzanine_patched_openupload-0.4.2/lib/main.inc.php 2011-03-18 09:11:21.000000000 +0100 @@ -485,8 +485,14 @@ $this->db->free(); exit(0); } else { - /* save the requested url */ - redirect('?action=login'); + /* Check if HTTP auth is used */ + if (($this->config['auth']=='httpldap') && + isset($_SERVER{$this->config['httpldap']['login']})) { + $this->user->authenticate(); + } else { + /* save the requested url */ + redirect('?action=login'); + } } } if ($_SERVER['QUERY_STRING']!='') diff -Nur -x '*.orig' -x '*.rej' openupload-0.4.2/lib/modules/auth/httpldap.inc.php mezzanine_patched_openupload-0.4.2/lib/modules/auth/httpldap.inc.php --- openupload-0.4.2/lib/modules/auth/httpldap.inc.php 1970-01-01 01:00:00.000000000 +0100 +++ mezzanine_patched_openupload-0.4.2/lib/modules/auth/httpldap.inc.php 2011-03-18 09:18:49.000000000 +0100 @@ -0,0 +1,31 @@ +config = app()->config['ldap']; + $this->http = app()->config['httpldap']; + $this->ufield = isset($this->config['uid'])?$this->config['uid']:'uid'; + $this->gfield = isset($this->config['gid'])?$this->config['gid']:'gid'; + + /* Which field contains the user login ? */ + $this->http['login'] = isset($this->http['login'])?$this->http['login']:'HTTP_AUTH_USER'; + + /* cannot add or edit users for now */ + $this->features = array('useradmin' => 'no', 'groupadmin' => 'no'); + } + + function authenticate($login,$password) { + $result = false; + if ($_SERVER{$this->http['login']} == $login) + $result = true; + return $result; + } + +} +?> + diff -Nur -x '*.orig' -x '*.rej' openupload-0.4.2/lib/user.inc.php mezzanine_patched_openupload-0.4.2/lib/user.inc.php --- openupload-0.4.2/lib/user.inc.php 2010-11-20 11:39:47.000000000 +0100 +++ mezzanine_patched_openupload-0.4.2/lib/user.inc.php 2011-03-18 09:11:21.000000000 +0100 @@ -69,7 +69,12 @@ return true; // if it's logging in save user and pwd - if (isset($_POST['username'])) { + if ((app()->config['auth']=='httpldap') && + isset($_SERVER{app()->config['httpldap']['login']})) { + $username = $_SERVER{app()->config['httpldap']['login']}; + $password = $_SERVER{app()->config['httpldap']['login']}; + } + elseif (isset($_POST['username'])) { $username = $_POST['username']; $password = $_POST['pwd']; } @@ -94,4 +99,4 @@ } } -?> \ Pas de fin de ligne à la fin du fichier. +?> diff -Nur -x '*.orig' -x '*.rej' openupload-0.4.2/www/config.inc.php.example mezzanine_patched_openupload-0.4.2/www/config.inc.php.example --- openupload-0.4.2/www/config.inc.php.example 2011-03-18 09:19:02.000000000 +0100 +++ mezzanine_patched_openupload-0.4.2/www/config.inc.php.example 2011-03-18 09:11:21.000000000 +0100 @@ -44,6 +44,14 @@ # $CONFIG['auth'] = 'ldap'; $CONFIG['auth'] = 'default'; +/************************************************************ + * HTTP/LDAP detail configuration options * + ************************************************************/ + +# $CONFIG['auth'] = 'httpldap'; +/* This is the field which contains user login */ +# $CONFIG['httpldap']['login'] = 'HTTP_AUTH_USER'; + /* TRANSLATION MODULE */ #$CONFIG['translator']='none';