/** * Create the good title link if we have already a ldap group linked or not * * @return String */ private function getLDAPTitle() { $hp = Codendi_HTMLPurifier::instance(); $ldapUserGroupManager = new LDAP_UserGroupManager($this->ldap_plugin->getLdap()); $ldapGroup = $ldapUserGroupManager->getLdapGroupByGroupId($this->ugroup->getId()); if ($ldapGroup !== null) { $grpName = $hp->purify($ldapGroup->getCommonName()); $title = $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_list_add_upd_binding', $grpName); } else { $title = $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_list_add_set_binding'); } return $title; }
/** * Hook in upgroup edition * $params['row'] A row from ugroup table * * @param Array $params */ function ugroup_table_row($params) { if ($GLOBALS['sys_auth_type'] == 'ldap' && $this->isLDAPGroupsUsageEnabled()) { // No ldap for project 100 if ($params['row']['group_id'] != 100) { $hp = Codendi_HTMLPurifier::instance(); $ldapUserGroupManager = new LDAP_UserGroupManager($this->getLdap()); $baseUrl = $this->getPluginPath() . '/ugroup_edit.php?ugroup_id=' . $params['row']['ugroup_id']; $urlAdd = $this->getPluginPath() . '/ugroup_add_user.php?ugroup_id=' . $params['row']['ugroup_id'] . '&func=add_user'; $linkAdd = '<a href="' . $urlAdd . '">- ' . $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_list_add_users') . '</a><br/>'; if (!$ldapUserGroupManager->isMembersUpdateAllowed($params['row']['ugroup_id'])) { $linkAdd = ''; } $ldapGroup = $ldapUserGroupManager->getLdapGroupByGroupId($params['row']['ugroup_id']); if ($ldapGroup !== null) { $grpName = $hp->purify($ldapGroup->getCommonName()); $title = $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_list_add_upd_binding', $grpName); } else { $title = $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_list_add_set_binding'); } $urlBind = $this->getPluginPath() . '/ugroup_edit.php?ugroup_id=' . $params['row']['ugroup_id'] . '&func=bind_with_group'; $linkBind = '<a href="' . $urlBind . '">- ' . $title . '</a>'; $params['html'] .= '<br />' . $linkAdd . $linkBind; } } }
project_admin_footer(array()); exit; } else { /* $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_ldap', 'invalid_ldap_group_name')); $GLOBALS['Response']->redirect('/project/admin/index.php?group_id='.$group_id);*/ } } } } } // // Display // $ugroupRow = ugroup_db_get_ugroup($ugroupId); $ugroupName = util_translate_name_ugroup($row['name']); $ldapGroup = $ldapUserGroupManager->getLdapGroupByGroupId($ugroupId); $clean_ugroupName = $hp->purify($ugroupName); if ($ldapGroup !== null) { $clean_ldapGroupName = $hp->purify($ldapGroup->getCommonName()); } else { $clean_ldapGroupName = ''; } project_admin_header(array('title' => $Language->getText('project_admin_editugroup', 'edit_ug'), 'group' => $group_id)); echo ' <script type="text/javascript" src="/scripts/prototype/prototype.js"></script> <script type="text/javascript" src="/scripts/scriptaculous/scriptaculous.js"></script> <script type="text/javascript" src="/scripts/autocomplete.js"></script> <script type="text/javascript" src="' . $pluginPath . '/scripts/autocomplete.js"></script> '; echo '<h2>' . $Language->getText('project_admin_editugroup', 'ug_admin', $clean_ugroupName) . '</h2>'; if ($ldapGroup !== null) {