Ejemplo n.º 1
0
 public function getTutor()
 {
     $tutor = null;
     if ($this->tutorId) {
         $tutor = new Claro_User($this->tutorId);
         $tutor->load();
     }
     return $tutor;
 }
Ejemplo n.º 2
0
 /**
  * Get the authentication profile for the given user id
  * @param int $userId
  * @return AuthProfile
  */
 public static function getUserAuthProfile($userId)
 {
     if ($userId != claro_get_current_user_id()) {
         $user = new Claro_User($userId);
         $user->loadFromDatabase();
     } else {
         $user = Claro_CurrentUser::getInstance();
     }
     $authSource = $user->authSource;
     if (!$authSource) {
         throw new Exception("Cannot find user authentication source for user {$userId}");
     }
     try {
         $profileOptions = AuthDriverManager::getDriver($authSource)->getAuthProfileOptions();
     } catch (Exception $e) {
         if (claro_is_platform_admin() || claro_is_in_a_course() && claro_is_course_manager() && $userId != claro_get_current_user_id()) {
             Console::warning("Cannot find user authentication source for user {$userId}, use claroline default options instead");
             $profileOptions = AuthDriverManager::getDriver('claroline')->getAuthProfileOptions();
         } else {
             throw $e;
         }
     }
     $authProfile = new AuthProfile($userId, $authSource);
     $authProfile->setAuthDriverOptions($profileOptions);
     if (claro_debug_mode()) {
         pushClaroMessage(var_export($profileOptions, true), 'debug');
     }
     return $authProfile;
 }
Ejemplo n.º 3
0
 public function __construct($userId = null)
 {
     $userId = empty($userId) ? claro_get_current_user_id() : $userId;
     parent::__construct($userId);
 }