====== Dokuwiki와 XE의 연동 ====== Dokuwiki의 로그인 권한을 XE와 연동하는 방식을 설명합니다. Rhymix 연동은 구성이 살짝 다릅니다. 제가 한 방식은 [[rhymix dokuwiki연동]]에서 설명하였습니다. 기본적으로 https://openwiki.kr/tech/authxe 를 따릅니다. 다만 다음 부분에서 차이가 있습니다. ===== define XE 설정 ===== 원문과 다르게 ''/inc/init.php''가 아니라 ''/inc/preload.php'' 파일을 생성하고, 그부분에 해당 내용을 추가했습니다. ''init.php'' 파일의 바로 하단을 확인하면 ''preload.php'' 파일이 존재할 경우 include하도록 되어있으므로, 버전 업데이트 등에서도 안전하게 로그인 연동을 수행할 수 있습니다. init(); //도쿠위키 시작시에 XE도 같이 시작하는 것이다. ?> =====authxe plugin 추가===== 이 부분은 원 문서와 거의 동일합니다. lib/plugins 폴더에 authxe 폴더를 추가하고 아래 파일을 넣었습니다. warning으로 인해 ''%%class_exists(Context)%%''를 ''%%class_exists('Context')%%''로 변경했습니다. */ class auth_plugin_authxe extends DokuWiki_Auth_Plugin { protected $users = null; protected $_pattern = array(); public function __construct() { parent::__construct(); $this->cando['external'] = true; global $config_cascade; } function trustExternal($user,$pass,$sticky=false){ global $USERINFO; if (class_exists('Context')) { $logged_info = Context::get("logged_info"); if($logged_info){ $sticky ? $sticky = true : $sticky = false; $USERINFO['name'] = $logged_info->nick_name; $USERINFO['pass'] = $logged_info->password; $USERINFO['mail'] = $logged_info->email_address; $USERINFO['grps'] = @array_values(@array_filter($logged_info->group_list)); $_SERVER['REMOTE_USER'] = $logged_info->user_id; $_SESSION[DOKU_COOKIE]['auth']['user'] = $logged_info->user_id; $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO; return true; } else return false; } else return false; } }