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