1*70316b84SAndreas Gohr<?php 2*70316b84SAndreas Gohr/** 3*70316b84SAndreas Gohr * DokuWiki Plugin @@PLUGIN_NAME@@ (Auth Component) 4*70316b84SAndreas Gohr * 5*70316b84SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6*70316b84SAndreas Gohr * @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@> 7*70316b84SAndreas Gohr */ 8*70316b84SAndreas Gohrclass @@PLUGIN_COMPONENT_NAME@@ extends \dokuwiki\Extension\AuthPlugin 9*70316b84SAndreas Gohr{ 10*70316b84SAndreas Gohr 11*70316b84SAndreas Gohr /** @inheritDoc */ 12*70316b84SAndreas Gohr public function __construct() 13*70316b84SAndreas Gohr { 14*70316b84SAndreas Gohr parent::__construct(); // for compatibility 15*70316b84SAndreas Gohr 16*70316b84SAndreas Gohr // FIXME set capabilities accordingly 17*70316b84SAndreas Gohr //$this->cando['addUser'] = false; // can Users be created? 18*70316b84SAndreas Gohr //$this->cando['delUser'] = false; // can Users be deleted? 19*70316b84SAndreas Gohr //$this->cando['modLogin'] = false; // can login names be changed? 20*70316b84SAndreas Gohr //$this->cando['modPass'] = false; // can passwords be changed? 21*70316b84SAndreas Gohr //$this->cando['modName'] = false; // can real names be changed? 22*70316b84SAndreas Gohr //$this->cando['modMail'] = false; // can emails be changed? 23*70316b84SAndreas Gohr //$this->cando['modGroups'] = false; // can groups be changed? 24*70316b84SAndreas Gohr //$this->cando['getUsers'] = false; // can a (filtered) list of users be retrieved? 25*70316b84SAndreas Gohr //$this->cando['getUserCount']= false; // can the number of users be retrieved? 26*70316b84SAndreas Gohr //$this->cando['getGroups'] = false; // can a list of available groups be retrieved? 27*70316b84SAndreas Gohr //$this->cando['external'] = false; // does the module do external auth checking? 28*70316b84SAndreas Gohr //$this->cando['logout'] = true; // can the user logout again? (eg. not possible with HTTP auth) 29*70316b84SAndreas Gohr 30*70316b84SAndreas Gohr // FIXME intialize your auth system and set success to true, if successful 31*70316b84SAndreas Gohr $this->success = true; 32*70316b84SAndreas Gohr } 33*70316b84SAndreas Gohr 34*70316b84SAndreas Gohr 35*70316b84SAndreas Gohr /** @inheritDoc */ 36*70316b84SAndreas Gohr // public function logOff() 37*70316b84SAndreas Gohr // { 38*70316b84SAndreas Gohr // } 39*70316b84SAndreas Gohr 40*70316b84SAndreas Gohr /** @inheritDoc */ 41*70316b84SAndreas Gohr //public function trustExternal($user, $pass, $sticky = false) 42*70316b84SAndreas Gohr //{ 43*70316b84SAndreas Gohr /* some example: 44*70316b84SAndreas Gohr 45*70316b84SAndreas Gohr global $USERINFO; 46*70316b84SAndreas Gohr global $conf; 47*70316b84SAndreas Gohr $sticky ? $sticky = true : $sticky = false; //sanity check 48*70316b84SAndreas Gohr 49*70316b84SAndreas Gohr // do the checking here 50*70316b84SAndreas Gohr 51*70316b84SAndreas Gohr // set the globals if authed 52*70316b84SAndreas Gohr $USERINFO['name'] = 'FIXME'; 53*70316b84SAndreas Gohr $USERINFO['mail'] = 'FIXME'; 54*70316b84SAndreas Gohr $USERINFO['grps'] = array('FIXME'); 55*70316b84SAndreas Gohr $_SERVER['REMOTE_USER'] = $user; 56*70316b84SAndreas Gohr $_SESSION[DOKU_COOKIE]['auth']['user'] = $user; 57*70316b84SAndreas Gohr $_SESSION[DOKU_COOKIE]['auth']['pass'] = $pass; 58*70316b84SAndreas Gohr $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO; 59*70316b84SAndreas Gohr return true; 60*70316b84SAndreas Gohr 61*70316b84SAndreas Gohr */ 62*70316b84SAndreas Gohr //} 63*70316b84SAndreas Gohr 64*70316b84SAndreas Gohr /** @inheritDoc */ 65*70316b84SAndreas Gohr public function checkPass($user, $pass) 66*70316b84SAndreas Gohr { 67*70316b84SAndreas Gohr // FIXME implement password check, alternatively implement trustExternal() 68*70316b84SAndreas Gohr return false; // return true if okay 69*70316b84SAndreas Gohr } 70*70316b84SAndreas Gohr 71*70316b84SAndreas Gohr /** @inheritDoc */ 72*70316b84SAndreas Gohr public function getUserData($user, $requireGroups=true) 73*70316b84SAndreas Gohr { 74*70316b84SAndreas Gohr /* 75*70316b84SAndreas Gohr FIXME implement and return something like this 76*70316b84SAndreas Gohr $userinfo = [ 77*70316b84SAndreas Gohr 'name' => 'Jon Doe', 78*70316b84SAndreas Gohr 'mail' => 'doe@example.com', 79*70316b84SAndreas Gohr 'grps' => ['user', 'admin'] 80*70316b84SAndreas Gohr ]; 81*70316b84SAndreas Gohr */ 82*70316b84SAndreas Gohr 83*70316b84SAndreas Gohr return false; 84*70316b84SAndreas Gohr } 85*70316b84SAndreas Gohr 86*70316b84SAndreas Gohr /** @inheritDoc */ 87*70316b84SAndreas Gohr //public function createUser($user, $pass, $name, $mail, $grps = null) 88*70316b84SAndreas Gohr //{ 89*70316b84SAndreas Gohr // FIXME implement 90*70316b84SAndreas Gohr // return null; 91*70316b84SAndreas Gohr //} 92*70316b84SAndreas Gohr 93*70316b84SAndreas Gohr /** @inheritDoc */ 94*70316b84SAndreas Gohr //public function modifyUser($user, $changes) 95*70316b84SAndreas Gohr //{ 96*70316b84SAndreas Gohr // FIXME implement 97*70316b84SAndreas Gohr // return false; 98*70316b84SAndreas Gohr //} 99*70316b84SAndreas Gohr 100*70316b84SAndreas Gohr /** @inheritDoc */ 101*70316b84SAndreas Gohr //public function deleteUsers($users) 102*70316b84SAndreas Gohr //{ 103*70316b84SAndreas Gohr // FIXME implement 104*70316b84SAndreas Gohr // return false; 105*70316b84SAndreas Gohr //} 106*70316b84SAndreas Gohr 107*70316b84SAndreas Gohr /** @inheritDoc */ 108*70316b84SAndreas Gohr //public function retrieveUsers($start = 0, $limit = 0, $filter = null) 109*70316b84SAndreas Gohr //{ 110*70316b84SAndreas Gohr // FIXME implement 111*70316b84SAndreas Gohr // return array(); 112*70316b84SAndreas Gohr //} 113*70316b84SAndreas Gohr 114*70316b84SAndreas Gohr /** @inheritDoc */ 115*70316b84SAndreas Gohr //public function getUserCount($filter = array()) 116*70316b84SAndreas Gohr //{ 117*70316b84SAndreas Gohr // FIXME implement 118*70316b84SAndreas Gohr // return 0; 119*70316b84SAndreas Gohr //} 120*70316b84SAndreas Gohr 121*70316b84SAndreas Gohr /** @inheritDoc */ 122*70316b84SAndreas Gohr //public function addGroup($group) 123*70316b84SAndreas Gohr //{ 124*70316b84SAndreas Gohr // FIXME implement 125*70316b84SAndreas Gohr // return false; 126*70316b84SAndreas Gohr //} 127*70316b84SAndreas Gohr 128*70316b84SAndreas Gohr /** @inheritDoc */ 129*70316b84SAndreas Gohr //public function retrieveGroups($start = 0, $limit = 0) 130*70316b84SAndreas Gohr //{ 131*70316b84SAndreas Gohr // FIXME implement 132*70316b84SAndreas Gohr // return array(); 133*70316b84SAndreas Gohr //} 134*70316b84SAndreas Gohr 135*70316b84SAndreas Gohr /** @inheritDoc */ 136*70316b84SAndreas Gohr public function isCaseSensitive() 137*70316b84SAndreas Gohr { 138*70316b84SAndreas Gohr return true; 139*70316b84SAndreas Gohr } 140*70316b84SAndreas Gohr 141*70316b84SAndreas Gohr /** @inheritDoc */ 142*70316b84SAndreas Gohr public function cleanUser($user) 143*70316b84SAndreas Gohr { 144*70316b84SAndreas Gohr return $user; 145*70316b84SAndreas Gohr } 146*70316b84SAndreas Gohr 147*70316b84SAndreas Gohr /** @inheritDoc */ 148*70316b84SAndreas Gohr public function cleanGroup($group) 149*70316b84SAndreas Gohr { 150*70316b84SAndreas Gohr return $group; 151*70316b84SAndreas Gohr } 152*70316b84SAndreas Gohr 153*70316b84SAndreas Gohr /** @inheritDoc */ 154*70316b84SAndreas Gohr //public function useSessionCache($user) 155*70316b84SAndreas Gohr //{ 156*70316b84SAndreas Gohr // FIXME implement 157*70316b84SAndreas Gohr //} 158*70316b84SAndreas Gohr} 159*70316b84SAndreas Gohr 160