contributions/usermanagement/behaviour/commands/base/loginknown.cmd.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Login known user command to be overloaded 00004 * 00005 * @author Gerd Riesselmann 00006 * @ingroup Usermanagement 00007 */ 00008 class LoginknownUsersBaseCommand extends CommandChain { 00009 /** 00010 * Returns title of command. 00011 */ 00012 public function get_name() { 00013 return 'login'; 00014 } 00015 00016 public function do_can_execute($user) { 00017 return empty($user); // Not logged in only 00018 } 00019 00020 public function do_execute() { 00021 $ret = new Status(); 00022 $user = $this->get_instance(); 00023 if ($user && $user->is_active()) { 00024 Session::push('current_user_id', $user->id); 00025 Session::pull('current_user'); 00026 AccessControl::set_current_aro($user); 00027 00028 Load::commands('generics/triggerevent'); 00029 $this->append(new TriggerEventCommand('login', $user)); 00030 } 00031 else { 00032 $ret->append(tr('You are not allowed to login', 'users')); 00033 } 00034 return $ret; 00035 } 00036 } 00037 ?>