00001 <?php
00002
00015
00016
00017
00018 import('plugins.AuthPlugin');
00019 import('security.AuthSourceDAO');
00020
00021 class AuthSourcesHandler extends AdminHandler {
00022
00026 function auth() {
00027 parent::validate();
00028 parent::setupTemplate(true);
00029
00030 $authDao = &DAORegistry::getDAO('AuthSourceDAO');
00031 $sources = &$authDao->getSources();
00032
00033 $plugins = &PluginRegistry::loadCategory(AUTH_PLUGIN_CATEGORY);
00034 $pluginOptions = array();
00035 foreach ($plugins as $plugin) {
00036 $pluginOptions[$plugin->getName()] = $plugin->getDisplayName();
00037 }
00038
00039 $templateMgr = &TemplateManager::getManager();
00040 $templateMgr->assign_by_ref('sources', $sources);
00041 $templateMgr->assign('pluginOptions', $pluginOptions);
00042 $templateMgr->assign('helpTopicId', 'site.siteManagement');
00043 $templateMgr->display('admin/auth/sources.tpl');
00044 }
00045
00049 function updateAuthSources() {
00050 parent::validate();
00051
00052 $authDao = &DAORegistry::getDAO('AuthSourceDAO');
00053 $authDao->setDefault((int) Request::getUserVar('defaultAuthId'));
00054
00055 Request::redirect(null, null, 'auth');
00056 }
00057
00061 function createAuthSource() {
00062 parent::validate();
00063
00064 $auth = &new AuthSource();
00065 $auth->setPlugin(Request::getUserVar('plugin'));
00066
00067 $authDao = &DAORegistry::getDAO('AuthSourceDAO');
00068 if ($authDao->insertSource($auth)) {
00069 Request::redirect(null, null, 'editAuthSource', $auth->getAuthId());
00070 } else {
00071 Request::redirect(null, null, 'auth');
00072 }
00073 }
00074
00078 function editAuthSource($args) {
00079 parent::validate();
00080 parent::setupTemplate(true);
00081
00082 import('security.form.AuthSourceSettingsForm');
00083 $form = &new AuthSourceSettingsForm((int)@$args[0]);
00084 $form->initData();
00085 $form->display();
00086 }
00087
00091 function updateAuthSource($args) {
00092 parent::validate();
00093
00094 import('security.form.AuthSourceSettingsForm');
00095 $form = &new AuthSourceSettingsForm((int)@$args[0]);
00096 $form->readInputData();
00097 $form->execute();
00098 Request::redirect(null, null, 'auth');
00099 }
00100
00104 function deleteAuthSource($args) {
00105 parent::validate();
00106
00107 $authId = (int)@$args[0];
00108 $authDao = &DAORegistry::getDAO('AuthSourceDAO');
00109 $authDao->deleteSource($authId);
00110 Request::redirect(null, null, 'auth');
00111 }
00112
00113 }
00114
00115 ?>