00001 <?php
00002
00015
00016
00017 import('plugins.AuthPlugin');
00018 import('security.AuthSourceDAO');
00019 import('pages.admin.AdminHandler');
00020
00021 class AuthSourcesHandler extends AdminHandler {
00025 function AuthSourcesHandler() {
00026 parent::AdminHandler();
00027 }
00028
00032 function auth() {
00033 $this->validate();
00034 $this->setupTemplate(true);
00035
00036 $authDao =& DAORegistry::getDAO('AuthSourceDAO');
00037 $sources =& $authDao->getSources();
00038
00039 $plugins =& PluginRegistry::loadCategory(AUTH_PLUGIN_CATEGORY);
00040 $pluginOptions = array();
00041 if (is_array($plugins)) foreach ($plugins as $plugin) {
00042 $pluginOptions[$plugin->getName()] = $plugin->getDisplayName();
00043 }
00044
00045 $templateMgr =& TemplateManager::getManager();
00046 $templateMgr->assign_by_ref('sources', $sources);
00047 $templateMgr->assign('pluginOptions', $pluginOptions);
00048 $templateMgr->assign('helpTopicId', 'site.siteManagement');
00049 $templateMgr->display('admin/auth/sources.tpl');
00050 }
00051
00055 function updateAuthSources() {
00056 $this->validate();
00057
00058 $authDao =& DAORegistry::getDAO('AuthSourceDAO');
00059 $authDao->setDefault((int) Request::getUserVar('defaultAuthId'));
00060
00061 Request::redirect(null, null, null, 'auth');
00062 }
00063
00067 function createAuthSource() {
00068 $this->validate();
00069
00070 $auth = new AuthSource();
00071 $auth->setPlugin(Request::getUserVar('plugin'));
00072
00073 $authDao =& DAORegistry::getDAO('AuthSourceDAO');
00074 if ($authDao->insertSource($auth)) {
00075 Request::redirect(null, null, null, 'editAuthSource', $auth->getAuthId());
00076 } else {
00077 Request::redirect(null, null, null, 'auth');
00078 }
00079 }
00080
00084 function editAuthSource($args) {
00085 $this->validate();
00086 $this->setupTemplate(true);
00087
00088 import('security.form.AuthSourceSettingsForm');
00089 $form = new AuthSourceSettingsForm((int)@$args[0]);
00090 $form->initData();
00091 $form->display();
00092 }
00093
00097 function updateAuthSource($args) {
00098 $this->validate();
00099
00100 import('security.form.AuthSourceSettingsForm');
00101 $form = new AuthSourceSettingsForm((int)@$args[0]);
00102 $form->readInputData();
00103 $form->execute();
00104 Request::redirect(null, null, null, 'auth');
00105 }
00106
00110 function deleteAuthSource($args) {
00111 $this->validate();
00112
00113 $authId = (int)@$args[0];
00114 $authDao =& DAORegistry::getDAO('AuthSourceDAO');
00115 $authDao->deleteObject($authId);
00116 Request::redirect(null, null, null, 'auth');
00117 }
00118 }
00119
00120 ?>