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