Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
dokuwiki [2018/10/12 11:21]
127.0.0.1 modification externe
dokuwiki [2020/04/12 22:43] (Version actuelle)
admin
Ligne 27: Ligne 27:
 Bootstrap3 Template Bootstrap3 Template
 ===Config=== ===Config===
 +==conf/local.php==
 +<code>
 +$conf['disableactions'] = 'register';
 +$conf['phpok'] = 1;$conf['authtype'] = 'authbalnam';
 +$conf['userewrite'] = 1;
 +</code>
 +==lin/plugin/authbalnam/auth.php==
 +<code>
 +class auth_plugin_authbalnam extends DokuWiki_Auth_Plugin {
 + 
 + 
 + function __construct() {
 + global $config_cascade;
 + global $connection;
 + 
 + $this->cando['external'] = true;
 + //$this->cando['logout'] = true;
 + 
 + }
 + 
 + function trustExternal($user, $pass, $sticky = false) {
 + 
 + global $USERINFO;
 + global $conf;
 + global $connection; 
 + $sticky ? $sticky = true : $sticky = false; //sanity check
 +        $allowed=$_SESSION['user']=='admin';
 +        if (!$allowed) {
 +          unset ($_SERVER['REMOTE_USER']);
 +          unset ($_SESSION[DOKU_COOKIE]['auth']);
 +          return false;
 +          }
 +        
 +          $_SERVER['REMOTE_USER'] =$_SESSION['user'];
 + $_SESSION[DOKU_COOKIE]['auth']['user'] = $_SESSION['user'];
 + $_SESSION[DOKU_COOKIE]['auth']['info']['mail'] = 'xx';
 + $_SESSION[DOKU_COOKIE]['auth']['info']['pass'] = 'xx';
 + $_SESSION[DOKU_COOKIE]['auth']['info']['grps'] = [0=>'admin',1=>'user'];
 +        
 + if (!empty($_SESSION[DOKU_COOKIE]['auth']['info'])) {
 +          print_r($_SESSION[DOKU_COOKIE]['auth']);
 + $USERINFO['name'] = $_SESSION[DOKU_COOKIE]['auth']['info']['user'];
 + $USERINFO['mail'] = $_SESSION[DOKU_COOKIE]['auth']['info']['mail'];
 + $USERINFO['grps'] = $_SESSION[DOKU_COOKIE]['auth']['info']['grps'];
 + $_SERVER['REMOTE_USER'] = $_SESSION[DOKU_COOKIE]['auth']['user'];
 + return true;
 + }
 +        
 +        /*if ($_SESSION['user']=='admin') {
 +     $_SERVER['REMOTE_USER'] =$_SESSION['user'];
 + $_SESSION[DOKU_COOKIE]['auth']['user'] = $_SESSION['user'];
 + $_SESSION[DOKU_COOKIE]['auth']['info']['mail'] = 'xx';
 + $_SESSION[DOKU_COOKIE]['auth']['info']['pass'] = 'xx';
 + $_SESSION[DOKU_COOKIE]['auth']['info']['grps'] = [0=>'admin',1=>'user'];
 + return true;
 + } else {
 + return false;
 + }     */
 +        return true;
 + 
 + }
 +
 +</code>
 +