/**
  * display settings menu
  * 
  * @access	public
  */
 function authSettingsObject()
 {
     global $rbacsystem, $ilSetting;
     if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $this->tabs_gui->setTabActive('authentication_settings');
     $this->setSubTabs('authSettings');
     $this->tabs_gui->setSubTabActive("auth_settings");
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.auth_general.html", "Services/Authentication");
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("TXT_AUTH_TITLE", $this->lng->txt("auth_select"));
     $this->tpl->setVariable("TXT_AUTH_MODE", $this->lng->txt("auth_mode"));
     $this->tpl->setVariable("TXT_AUTH_DEFAULT", $this->lng->txt("default"));
     $this->tpl->setVariable("TXT_AUTH_ACTIVE", $this->lng->txt("active"));
     $this->tpl->setVariable("TXT_AUTH_NUM_USERS", $this->lng->txt("num_users"));
     $this->tpl->setVariable("TXT_LOCAL", $this->lng->txt("auth_local"));
     $this->tpl->setVariable("TXT_LDAP", $this->lng->txt("auth_ldap"));
     $this->tpl->setVariable("TXT_SHIB", $this->lng->txt("auth_shib"));
     $this->tpl->setVariable("TXT_CAS", $this->lng->txt("auth_cas"));
     $this->tpl->setVariable("TXT_RADIUS", $this->lng->txt("auth_radius"));
     $this->tpl->setVariable("TXT_SCRIPT", $this->lng->txt("auth_script"));
     $this->tpl->setVariable("TXT_APACHE", $this->lng->txt("auth_apache"));
     $auth_cnt = ilObjUser::_getNumberOfUsersPerAuthMode();
     $auth_modes = ilAuthUtils::_getAllAuthModes();
     foreach ($auth_modes as $mode => $mode_name) {
         //echo "-".$ilSetting->get('auth_mode')."-".$mode."-";
         if ($ilSetting->get('auth_mode') == $mode) {
             $this->tpl->setVariable("NUM_" . strtoupper($mode_name), (int) $auth_cnt[$mode_name] + $auth_cnt["default"] . " (" . $this->lng->txt("auth_per_default") . ": " . $auth_cnt["default"] . ")");
         } else {
             $this->tpl->setVariable("NUM_" . strtoupper($mode_name), (int) $auth_cnt[$mode_name]);
         }
     }
     $this->tpl->setVariable("TXT_CONFIGURE", $this->lng->txt("auth_configure"));
     $this->tpl->setVariable("TXT_AUTH_REMARK", $this->lng->txt("auth_remark_non_local_auth"));
     $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
     $this->tpl->setVariable("CMD_SUBMIT", "setAuthMode");
     // local vars
     $checked = "checked=\"checked\"";
     $disabled = "disabled=\"disabled\"";
     $style_disabled = "_disabled";
     // icon handlers
     $icon_ok = "<img src=\"" . ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"" . $this->lng->txt("enabled") . "\" title=\"" . $this->lng->txt("enabled") . "\" border=\"0\" vspace=\"0\"/>";
     $icon_not_ok = "<img src=\"" . ilUtil::getImagePath("icon_not_ok.svg") . "\" alt=\"" . $this->lng->txt("disabled") . "\" title=\"" . $this->lng->txt("disabled") . "\" border=\"0\" vspace=\"0\"/>";
     $this->tpl->setVariable("AUTH_LOCAL_ACTIVE", $icon_ok);
     include_once 'Services/LDAP/classes/class.ilLDAPServer.php';
     $this->tpl->setVariable('AUTH_LDAP_ACTIVE', count(ilLDAPServer::_getActiveServerList()) ? $icon_ok : $icon_not_ok);
     #$this->tpl->setVariable("AUTH_LDAP_ACTIVE", $this->ilias->getSetting('ldap_active') ? $icon_ok : $icon_not_ok);
     $this->tpl->setVariable("AUTH_RADIUS_ACTIVE", $this->ilias->getSetting('radius_active') ? $icon_ok : $icon_not_ok);
     $this->tpl->setVariable("AUTH_SHIB_ACTIVE", $this->ilias->getSetting('shib_active') ? $icon_ok : $icon_not_ok);
     $this->tpl->setVariable("AUTH_SCRIPT_ACTIVE", $this->ilias->getSetting('script_active') ? $icon_ok : $icon_not_ok);
     $this->tpl->setVariable("AUTH_CAS_ACTIVE", $this->ilias->getSetting('cas_active') ? $icon_ok : $icon_not_ok);
     $this->tpl->setVariable("AUTH_APACHE_ACTIVE", $this->ilias->getSetting('apache_active') ? $icon_ok : $icon_not_ok);
     // alter style and disable buttons depending on current selection
     switch ($this->ilias->getSetting('auth_mode')) {
         case AUTH_LOCAL:
             // default
             $this->tpl->setVariable("CHK_LOCAL", $checked);
             break;
         case AUTH_LDAP:
             // LDAP
             $this->tpl->setVariable("CHK_LDAP", $checked);
             break;
         case AUTH_SHIBBOLETH:
             // SHIB
             $this->tpl->setVariable("CHK_SHIB", $checked);
             break;
         case AUTH_RADIUS:
             // RADIUS
             $this->tpl->setVariable("CHK_RADIUS", $checked);
             break;
         case AUTH_CAS:
             // CAS
             $this->tpl->setVariable("CHK_CAS", $checked);
             break;
         case AUTH_SCRIPT:
             // script
             $this->tpl->setVariable("CHK_SCRIPT", $checked);
             break;
         case AUTH_APACHE:
             // apache
             $this->tpl->setVariable("CHK_APACHE", $checked);
             break;
     }
     // auth mode determinitation
     if ($this->initAuthModeDetermination()) {
         $this->tpl->setVariable('TABLE_AUTH_DETERMINATION', $this->form->getHTML());
     }
     // roles table
     $this->tpl->setVariable("FORMACTION_ROLES", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("TXT_AUTH_ROLES", $this->lng->txt("auth_active_roles"));
     $this->tpl->setVariable("TXT_ROLE", $this->lng->txt("obj_role"));
     $this->tpl->setVariable("TXT_ROLE_AUTH_MODE", $this->lng->txt("auth_role_auth_mode"));
     $this->tpl->setVariable("CMD_SUBMIT_ROLES", "updateAuthRoles");
     include_once "./Services/AccessControl/classes/class.ilObjRole.php";
     $reg_roles = ilObjRole::_lookupRegisterAllowed();
     // auth mode selection
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
     foreach ($reg_roles as $role) {
         foreach ($active_auth_modes as $auth_name => $auth_key) {
             // do not list auth modes with external login screen
             // even not default, because it can easily be set to
             // a non-working auth mode
             if ($auth_name == "default" || $auth_name == "cas" || $auth_name == "shibboleth" || $auth_name == 'ldap' || $auth_name == 'apache' || $auth_name == "ecs" || $auth_name == "openid") {
                 continue;
             }
             $this->tpl->setCurrentBlock("auth_mode_selection");
             if ($auth_name == 'default') {
                 $name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")";
             } else {
                 $name = $this->lng->txt('auth_' . $auth_name);
             }
             $this->tpl->setVariable("AUTH_MODE_NAME", $name);
             $this->tpl->setVariable("AUTH_MODE", $auth_name);
             if ($role['auth_mode'] == $auth_name) {
                 $this->tpl->setVariable("SELECTED_AUTH_MODE", "selected=\"selected\"");
             }
             $this->tpl->parseCurrentBlock();
         }
         // END auth_mode selection
         $this->tpl->setCurrentBlock("roles");
         $this->tpl->setVariable("ROLE", $role['title']);
         $this->tpl->setVariable("ROLE_ID", $role['id']);
         $this->tpl->parseCurrentBlock();
     }
 }
Exemplo n.º 2
0
 /**
  * Check if an external account name is required.
  * That's the case if Radius,LDAP, CAS or SOAP is active
  *
  * @access public
  * @static
  *
  * @param
  */
 public static function _isExternalAccountEnabled()
 {
     global $ilSetting;
     if ($ilSetting->get("cas_active")) {
         return true;
     }
     if ($ilSetting->get("soap_auth_active")) {
         return true;
     }
     if ($ilSetting->get("shib_active")) {
         return true;
     }
     if ($ilSetting->get('radius_active')) {
         return true;
     }
     include_once 'Services/LDAP/classes/class.ilLDAPServer.php';
     if (count(ilLDAPServer::_getActiveServerList())) {
         return true;
     }
     include_once './Services/OpenId/classes/class.ilOpenIdSettings.php';
     if (ilOpenIdSettings::getInstance()->isActive()) {
         return true;
     }
     return false;
 }
Exemplo n.º 3
0
 /** 
  * Get first active server
  *
  * @return int first active server
  */
 public static function _getFirstActiveServer()
 {
     $servers = ilLDAPServer::_getActiveServerList();
     if (count($servers)) {
         return $servers[0];
     }
     return 0;
 }
Exemplo n.º 4
0
 /**
  * Check if an external account name is required.
  * That's the case if Radius,LDAP, CAS or SOAP is active
  *
  * @access public
  * @static
  *
  * @param
  */
 public static function _isExternalAccountEnabled()
 {
     global $ilSetting;
     if ($ilSetting->get("cas_active")) {
         return true;
     }
     if ($ilSetting->get("soap_auth_active")) {
         return true;
     }
     if ($ilSetting->get("shib_active")) {
         return true;
     }
     if ($ilSetting->get('radius_active')) {
         return true;
     }
     include_once 'Services/LDAP/classes/class.ilLDAPServer.php';
     if (count(ilLDAPServer::_getActiveServerList())) {
         return true;
     }
     include_once './Services/OpenId/classes/class.ilOpenIdSettings.php';
     if (ilOpenIdSettings::getInstance()->isActive()) {
         return true;
     }
     // begin-path auth_plugin
     foreach (self::getAuthPlugins() as $pl) {
         foreach ($pl->getAuthIds() as $auth_id) {
             if ($pl->isAuthActive($auth_id) and $pl->isExternalAccountNameRequired($auth_id)) {
                 return true;
             }
         }
     }
     // end-path auth_plugin
     return false;
 }