.

ConfirmUserDataRenderDecorator Class Reference
[Controller]

A render decorator that forces users to confirm or update their account data. More...

Inheritance diagram for ConfirmUserDataRenderDecorator:
RenderDecoratorBase IRenderDecorator

List of all members.

Public Member Functions

  initialize ($page_data)
  Initialize this decorator and the data passed.

Static Public Member Functions

static  add_allowed_route_ids ($route_ids)
  Add allowed route ids.
static  get_allowed_route_ids ()
  Return the allowed route ids.

Protected Member Functions

  confirm_data_if_required ($user, PageData $page_data)
  Check if data must be confirmed, if so do it.
  is_allowed_route ($route_id)
  Returns true, if the current route is allowed.

Detailed Description

A render decorator that forces users to confirm or update their account data.

This render decorator

  • checks if a user is logged in
  • for logged in users checks if the email address is CONFIRMED and the TOS the user acknowledged are the same then the current valid TOS
  • If this fails redirects to action "users_confirmdata"
  • Except if the current route is one of the allowed ones, that can be set through ConfirmUserDataRenderDecorator::append_allowed_route_id()
Author:
Gerd Riesselmann

Definition at line 20 of file confirmuserdatarenderdecorator.cls.php.


Member Function Documentation

static ConfirmUserDataRenderDecorator::add_allowed_route_ids ( route_ids  )  [static]

Add allowed route ids.

Parameters:
array|string  $route_ids

Definition at line 89 of file confirmuserdatarenderdecorator.cls.php.

00089                                                                  {
00090                 self::$allowed_route_ids = array_merge(self::$allowed_route_ids, Arr::force($route_ids, false));
00091         }
ConfirmUserDataRenderDecorator::confirm_data_if_required ( user,
PageData page_data  
) [protected]

Check if data must be confirmed, if so do it.

Parameters:
DAOUsers  $user

Definition at line 43 of file confirmuserdatarenderdecorator.cls.php.

00043                                                                                 {
00044                 if ($user->confirmed_email() == false || $user->confirmed_tos() == false) {
00045                         if (!$this->is_allowed_route($page_data->router->get_route_id())) {
00046                                 if ($page_data->status) {
00047                                         $page_data->status->persist();
00048                                 }
00049                                 if (Session::pull('user_confirm_mail_send')) {
00050                                         Url::create(ActionMapper::get_url('users_confirm_mail'))->redirect(Url::TEMPORARY);
00051                                 }
00052                                 else {
00053                                         Url::create(ActionMapper::get_url('users_confirm'))->redirect(Url::TEMPORARY);
00054                                 }
00055                                 exit;
00056                         }
00057                 }
00058         }
static ConfirmUserDataRenderDecorator::get_allowed_route_ids (  )  [static]

Return the allowed route ids.

Returns:
array

Definition at line 80 of file confirmuserdatarenderdecorator.cls.php.

00080                                                        {
00081                 return self::$allowed_route_ids;
00082         }
ConfirmUserDataRenderDecorator::initialize ( page_data  ) 

Initialize this decorator and the data passed.

Parameters:
PageData  $page_data
Returns:
void

Reimplemented from RenderDecoratorBase.

Definition at line 29 of file confirmuserdatarenderdecorator.cls.php.

00029                                                {
00030                 $user = Users::get_current_user();
00031                 if ($user) {
00032                         $this->confirm_data_if_required($user, $page_data);
00033                 }
00034                 
00035                 parent::initialize($page_data);
00036         }       
ConfirmUserDataRenderDecorator::is_allowed_route ( route_id  )  [protected]

Returns true, if the current route is allowed.

Parameters:
string  $route_id
Returns:
bool

Definition at line 66 of file confirmuserdatarenderdecorator.cls.php.

00066                                                        {
00067                 $allowed = self::get_allowed_route_ids();
00068                 $allowed[] = 'UsersController::users_confirm';
00069                 $allowed[] = 'UsersController::users_confirm_mail';
00070                 $allowed[] = 'UsersController::logout';
00071                 $allowed[] = 'ConfirmationsController::confirm';
00072                 return in_array($route_id, $allowed);
00073         }

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