.

HijackaccountController Class Reference

Inheritance diagram for HijackaccountController:
ControllerBase IController IEventSink

List of all members.

Public Member Functions

  action_users_hijack (PageData $page_data, $id)
  Hijack given account.
  get_routes ()
  Return array of Route instances which are handled by this controller.

Detailed Description

Definition at line 2 of file hijackaccount.controller.php.


Member Function Documentation

HijackaccountController::action_users_hijack ( PageData page_data,
id  
)

Hijack given account.

Definition at line 17 of file hijackaccount.controller.php.

00017                                                                       {
00018                 $user = Users::get($id);
00019                 if ($user === false) {
00020                         return self::NOT_FOUND;
00021                 }
00022                 
00023                 $cmd = CommandsFactory::create_command($user, 'hijack', false);
00024                 $ok = $cmd->can_execute(false);
00025                 if (!$ok) {
00026                         return self::ACCESS_DENIED;
00027                 }
00028                 
00029                 $err = $cmd->execute();
00030                 if ($err->is_ok()) {
00031                         $err = new Message(tr(
00032                                 'You now have been logged in as %name. If you log out, you will return to you old session', 
00033                                 'hijackaccount', 
00034                                 array('%name' => $user->get_title())
00035                         ));
00036                 }
00037                 History::go_to(0, $err);
00038         }
HijackaccountController::get_routes (  ) 

Return array of Route instances which are handled by this controller.

Returns:
array Array of Routes

Reimplemented from ControllerBase.

Definition at line 8 of file hijackaccount.controller.php.

00008                                      {
00009                 return array(
00010                         new CommandsRoute('https://process_commands/users/{id:ui>}/hijack', $this, 'users_hijack', new UsersAccessControl())
00011                 );
00012         }       

The documentation for this class was generated from the following file: