170316b84SAndreas Gohr<?php 2*8673a04eSAndreas Gohr 3*8673a04eSAndreas Gohruse dokuwiki\Extension\AuthPlugin; 4*8673a04eSAndreas Gohr 570316b84SAndreas Gohr/** 670316b84SAndreas Gohr * DokuWiki Plugin @@PLUGIN_NAME@@ (Auth Component) 770316b84SAndreas Gohr * 870316b84SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 970316b84SAndreas Gohr * @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@> 1070316b84SAndreas Gohr */ 11*8673a04eSAndreas Gohrclass @@PLUGIN_COMPONENT_NAME@@ extends AuthPlugin 1270316b84SAndreas Gohr{ 1370316b84SAndreas Gohr /** @inheritDoc */ 1470316b84SAndreas Gohr public function __construct() 1570316b84SAndreas Gohr { 1670316b84SAndreas Gohr parent::__construct(); // for compatibility 1770316b84SAndreas Gohr 1870316b84SAndreas Gohr // FIXME set capabilities accordingly 1970316b84SAndreas Gohr //$this->cando['addUser'] = false; // can Users be created? 2070316b84SAndreas Gohr //$this->cando['delUser'] = false; // can Users be deleted? 2170316b84SAndreas Gohr //$this->cando['modLogin'] = false; // can login names be changed? 2270316b84SAndreas Gohr //$this->cando['modPass'] = false; // can passwords be changed? 2370316b84SAndreas Gohr //$this->cando['modName'] = false; // can real names be changed? 2470316b84SAndreas Gohr //$this->cando['modMail'] = false; // can emails be changed? 2570316b84SAndreas Gohr //$this->cando['modGroups'] = false; // can groups be changed? 2670316b84SAndreas Gohr //$this->cando['getUsers'] = false; // can a (filtered) list of users be retrieved? 2770316b84SAndreas Gohr //$this->cando['getUserCount']= false; // can the number of users be retrieved? 2870316b84SAndreas Gohr //$this->cando['getGroups'] = false; // can a list of available groups be retrieved? 2970316b84SAndreas Gohr //$this->cando['external'] = false; // does the module do external auth checking? 3070316b84SAndreas Gohr //$this->cando['logout'] = true; // can the user logout again? (eg. not possible with HTTP auth) 3170316b84SAndreas Gohr 3270316b84SAndreas Gohr // FIXME intialize your auth system and set success to true, if successful 3370316b84SAndreas Gohr $this->success = true; 3470316b84SAndreas Gohr } 3570316b84SAndreas Gohr 3670316b84SAndreas Gohr /** @inheritDoc */ 3770316b84SAndreas Gohr // public function logOff() 3870316b84SAndreas Gohr // { 3970316b84SAndreas Gohr // } 4070316b84SAndreas Gohr 4170316b84SAndreas Gohr /** @inheritDoc */ 4270316b84SAndreas Gohr //public function trustExternal($user, $pass, $sticky = false) 4370316b84SAndreas Gohr //{ 4470316b84SAndreas Gohr /* some example: 4570316b84SAndreas Gohr 4670316b84SAndreas Gohr global $USERINFO; 4770316b84SAndreas Gohr global $conf; 4870316b84SAndreas Gohr $sticky ? $sticky = true : $sticky = false; //sanity check 4970316b84SAndreas Gohr 5070316b84SAndreas Gohr // do the checking here 5170316b84SAndreas Gohr 5270316b84SAndreas Gohr // set the globals if authed 5370316b84SAndreas Gohr $USERINFO['name'] = 'FIXME'; 5470316b84SAndreas Gohr $USERINFO['mail'] = 'FIXME'; 5570316b84SAndreas Gohr $USERINFO['grps'] = array('FIXME'); 5670316b84SAndreas Gohr $_SERVER['REMOTE_USER'] = $user; 5770316b84SAndreas Gohr $_SESSION[DOKU_COOKIE]['auth']['user'] = $user; 5870316b84SAndreas Gohr $_SESSION[DOKU_COOKIE]['auth']['pass'] = $pass; 5970316b84SAndreas Gohr $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO; 6070316b84SAndreas Gohr return true; 6170316b84SAndreas Gohr 6270316b84SAndreas Gohr */ 6370316b84SAndreas Gohr //} 6470316b84SAndreas Gohr 6570316b84SAndreas Gohr /** @inheritDoc */ 6670316b84SAndreas Gohr public function checkPass($user, $pass) 6770316b84SAndreas Gohr { 6870316b84SAndreas Gohr // FIXME implement password check, alternatively implement trustExternal() 6970316b84SAndreas Gohr return false; // return true if okay 7070316b84SAndreas Gohr } 7170316b84SAndreas Gohr 7270316b84SAndreas Gohr /** @inheritDoc */ 7370316b84SAndreas Gohr public function getUserData($user, $requireGroups = true) 7470316b84SAndreas Gohr { 7570316b84SAndreas Gohr /* 7670316b84SAndreas Gohr FIXME implement and return something like this 7770316b84SAndreas Gohr $userinfo = [ 7870316b84SAndreas Gohr 'name' => 'Jon Doe', 7970316b84SAndreas Gohr 'mail' => 'doe@example.com', 8070316b84SAndreas Gohr 'grps' => ['user', 'admin'] 8170316b84SAndreas Gohr ]; 8270316b84SAndreas Gohr */ 8370316b84SAndreas Gohr 8470316b84SAndreas Gohr return false; 8570316b84SAndreas Gohr } 8670316b84SAndreas Gohr 8770316b84SAndreas Gohr /** @inheritDoc */ 8870316b84SAndreas Gohr //public function createUser($user, $pass, $name, $mail, $grps = null) 8970316b84SAndreas Gohr //{ 9070316b84SAndreas Gohr // FIXME implement 9170316b84SAndreas Gohr // return null; 9270316b84SAndreas Gohr //} 9370316b84SAndreas Gohr 9470316b84SAndreas Gohr /** @inheritDoc */ 9570316b84SAndreas Gohr //public function modifyUser($user, $changes) 9670316b84SAndreas Gohr //{ 9770316b84SAndreas Gohr // FIXME implement 9870316b84SAndreas Gohr // return false; 9970316b84SAndreas Gohr //} 10070316b84SAndreas Gohr 10170316b84SAndreas Gohr /** @inheritDoc */ 10270316b84SAndreas Gohr //public function deleteUsers($users) 10370316b84SAndreas Gohr //{ 10470316b84SAndreas Gohr // FIXME implement 10570316b84SAndreas Gohr // return false; 10670316b84SAndreas Gohr //} 10770316b84SAndreas Gohr 10870316b84SAndreas Gohr /** @inheritDoc */ 10970316b84SAndreas Gohr //public function retrieveUsers($start = 0, $limit = 0, $filter = null) 11070316b84SAndreas Gohr //{ 11170316b84SAndreas Gohr // FIXME implement 11270316b84SAndreas Gohr // return array(); 11370316b84SAndreas Gohr //} 11470316b84SAndreas Gohr 11570316b84SAndreas Gohr /** @inheritDoc */ 11670316b84SAndreas Gohr //public function getUserCount($filter = array()) 11770316b84SAndreas Gohr //{ 11870316b84SAndreas Gohr // FIXME implement 11970316b84SAndreas Gohr // return 0; 12070316b84SAndreas Gohr //} 12170316b84SAndreas Gohr 12270316b84SAndreas Gohr /** @inheritDoc */ 12370316b84SAndreas Gohr //public function addGroup($group) 12470316b84SAndreas Gohr //{ 12570316b84SAndreas Gohr // FIXME implement 12670316b84SAndreas Gohr // return false; 12770316b84SAndreas Gohr //} 12870316b84SAndreas Gohr 12970316b84SAndreas Gohr /** @inheritDoc */ 13070316b84SAndreas Gohr //public function retrieveGroups($start = 0, $limit = 0) 13170316b84SAndreas Gohr //{ 13270316b84SAndreas Gohr // FIXME implement 13370316b84SAndreas Gohr // return array(); 13470316b84SAndreas Gohr //} 13570316b84SAndreas Gohr 13670316b84SAndreas Gohr /** @inheritDoc */ 13770316b84SAndreas Gohr public function isCaseSensitive() 13870316b84SAndreas Gohr { 13970316b84SAndreas Gohr return true; 14070316b84SAndreas Gohr } 14170316b84SAndreas Gohr 14270316b84SAndreas Gohr /** @inheritDoc */ 14370316b84SAndreas Gohr public function cleanUser($user) 14470316b84SAndreas Gohr { 14570316b84SAndreas Gohr return $user; 14670316b84SAndreas Gohr } 14770316b84SAndreas Gohr 14870316b84SAndreas Gohr /** @inheritDoc */ 14970316b84SAndreas Gohr public function cleanGroup($group) 15070316b84SAndreas Gohr { 15170316b84SAndreas Gohr return $group; 15270316b84SAndreas Gohr } 15370316b84SAndreas Gohr 15470316b84SAndreas Gohr /** @inheritDoc */ 15570316b84SAndreas Gohr //public function useSessionCache($user) 15670316b84SAndreas Gohr //{ 15770316b84SAndreas Gohr // FIXME implement 15870316b84SAndreas Gohr //} 15970316b84SAndreas Gohr} 160