예제 #1
0
 public function authenticate()
 {
     try {
         $as = new \SimpleSAML_Auth_Simple($this->_domain);
         $globalConfig = \SimpleSAML_Configuration::getInstance();
         //$globalConfig::setConfigDir(G_CONFIGDIR.'saml/');
         $as->requireAuth();
         if ($as->isAuthenticated()) {
             $attributes = $as->getAttributes();
             if (!array_key_exists($this->_sso_settings['saml_email'], $attributes)) {
                 // 					TemplateController::setMessage(("A valid email is needed for account related communication").". ".("Check that the %s attribute (%s) defined in your configuration is correct",("Email"),$this->_sso_settings['saml_email']), 'error');
                 $this->ssoLogout();
             } elseif (!array_key_exists($this->_sso_settings['saml_first_name'], $attributes)) {
                 // 					TemplateController::setMessage(("'%s' is required",("First name")).". ".("Check that the %s attribute (%s) defined in your configuration is correct",("First name"),$this->_sso_settings['saml_first_name']), 'error');
                 $this->ssoLogout();
             } elseif (!array_key_exists($this->_sso_settings['saml_last_name'], $attributes)) {
                 // 					TemplateController::setMessage(("'%s' is required",("Last name")).". ".("Check that the %s attribute (%s) defined in your configuration is correct",("Last name"),$this->_sso_settings['saml_last_name']), 'error');
                 $this->ssoLogout();
             } else {
                 if (trim($attributes[$this->_sso_settings['saml_email']][0]) == '') {
                     $attributes[$this->_sso_settings['saml_email']][0] = " ";
                     // 						TemplateController::setMessage(("A valid email is needed for account related communication"), 'error');
                 }
                 if (trim($attributes[$this->_sso_settings['saml_first_name']][0]) == '' && trim($attributes[$this->_sso_settings['saml_last_name']][0]) == '') {
                     $attributes[$this->_sso_settings['saml_first_name']][0] = ' ';
                     $attributes[$this->_sso_settings['saml_last_name']][0] = ' ';
                 } else {
                     if (trim($attributes[$this->_sso_settings['saml_first_name']][0]) == '') {
                         $attributes[$this->_sso_settings['saml_first_name']][0] = $attributes[$this->_sso_settings['saml_last_name']][0];
                     }
                     if (trim($attributes[$this->_sso_settings['saml_last_name']][0]) == '') {
                         $attributes[$this->_sso_settings['saml_last_name']][0] = $attributes[$this->_sso_settings['saml_first_name']][0];
                     }
                 }
                 $this->_login($attributes);
                 //pr($attributes);exit;
                 //echo "redirect now";exit;
                 //\SimpleSAML_Utilities::postRedirect("https://index.php", $attributes);
             }
         }
     } catch (\SimpleSAML_Error_Error $e) {
         $this->_samlErrorHandler($e);
     } catch (\Exception $e) {
         handleNormalFlowExceptions($e);
     }
     return $this;
 }
예제 #2
0
        #cpp#endif
        if ((!isset($currentUser->coreAccess['personal_messages']) || $currentUser->coreAccess['personal_messages'] != 'hidden') && EfrontUser::isOptionVisible('messages')) {
            $myCoursesOptions[] = array('text' => _MESSAGES, 'image' => "32x32/mail.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=messages");
        }
        if (EfrontUser::isOptionVisible('statistics')) {
            $myCoursesOptions[] = array('text' => _STATISTICS, 'image' => "32x32/reports.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=statistics");
        }
        if (EfrontUser::isOptionVisible('forum')) {
            $myCoursesOptions[] = array('text' => _FORUM, 'image' => "32x32/forum.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=forum");
        }
        if (EfrontUser::isOptionVisible('calendar')) {
            $myCoursesOptions[] = array('text' => _CALENDAR, 'image' => "32x32/calendar.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=calendar");
        }
        if (EfrontUser::isOptionVisible('professor_courses') && ($_SESSION['s_type'] == 'professor' || $currentUser->user['user_type'] == 'professor')) {
            if ($currentUser->coreAccess['professor_courses'] != 'hidden') {
                $myCoursesOptions[] = array('text' => _COURSES, 'image' => "32x32/courses.png", 'href' => "professor.php?ctg=courses");
                $myCoursesOptions[] = array('text' => _LESSONS, 'image' => "32x32/lessons.png", 'href' => "professor.php?ctg=professor_lessons");
            }
        }
        foreach ($loadedModules as $module) {
            if ($linkInfo = $module->getToolsLinkInfo()) {
                $myCoursesOptions[] = array('text' => $linkInfo['title'], 'image' => eF_getRelativeModuleImagePath($linkInfo['image']), 'href' => $linkInfo['link']);
            }
        }
        $smarty->assign("T_LAYOUT_CLASS", $currentTheme->options['toolbar_position'] == "left" ? "hideRight" : "hideLeft");
        //Whether to show the sidemenu on the left or on the right
        $smarty->assign("T_COURSES_LIST_OPTIONS", $myCoursesOptions);
    }
} catch (Exception $e) {
    handleNormalFlowExceptions($e);
}
예제 #3
0
 public static function handleInstallationExceptions($e)
 {
     if ($_GET['unattended']) {
         handleAjaxExceptions($e);
     } else {
         handleNormalFlowExceptions($e);
     }
 }