.

CreatePermanentloginsCommand Class Reference
[Usermanagement]

Create a permanent login. More...

Inheritance diagram for CreatePermanentloginsCommand:
CommandComposite CommandBase ICommand IAction ISerializable

List of all members.

Protected Member Functions

  do_execute ()
  Does executing.

Detailed Description

Create a permanent login.

Author:
Gerd Riesselmann

Definition at line 8 of file create.cmd.php.


Member Function Documentation

CreatePermanentloginsCommand::do_execute (  )  [protected]

Does executing.

Reimplemented from CommandComposite.

Definition at line 12 of file create.cmd.php.

00012                                         {
00013                 $ret = new Status();
00014                 // Delete expired
00015                 Load::commands('generics/massdelete', 'generics/create', 'generics/cookie.set');
00016                 $this->append(new MassDeleteCommand('permanentlogins', new DBCondition('expirationdate', '<', time())));
00017                 
00018                 // Create new entry
00019                 $user = $this->get_params();
00020                 $salt = $user->creationdate . $user->password . $user->modificationdate;
00021                 $code = Common::create_token($salt);
00022                 $validtime = Cast::int(Config::get_value(ConfigUsermanagement::PERMANENT_LOGIN_DURATION)) * GyroDate::ONE_DAY;
00023                 $params = array(
00024                         'code' => $code,
00025                         'expirationdate' => time() + $validtime,
00026                         'id_user' => $user->id
00027                 );
00028                 $this->append(new CreateCommand('permanentlogins', $params));
00029                 
00030                 // Set cookie
00031                 $this->append(new CookieSetCommand(PermanentLogins::COOKIE_NAME, $code, $validtime));
00032                 
00033                 return $ret;
00034         }

The documentation for this class was generated from the following file:
  • contributions/usermanagement/behaviour/commands/permanentlogins/create.cmd.php