← Back to team overview

mahara-contributors team mailing list archive

[Bug 922031] A change has been merged

 

Reviewed:  https://reviews.mahara.org/1038
Committed: http://gitorious.org/mahara/mahara/commit/245abd15d607123a34fe705c0b696abd7b269fd1
Submitter: Francois Marier (francois@xxxxxxxxxxxxxxx)
Branch:    master

commit 245abd15d607123a34fe705c0b696abd7b269fd1
Author: Richard Mansfield <richard.mansfield@xxxxxxxxxxxxxxx>
Date:   Tue Feb 7 11:06:17 2012 +1300

    Convert suspended date when reloading user object (bug #922031)
    
    Commit 725ba9294039b82bec947be5301acf160f4744ae tries to reload
    certain admin-settable fields from the database into a LiveUser when
    committing, but fails to convert the suspended date to a timestamp
    when doing so.  This causes the date to be displayed incorrectly to
    suspended users when they log in.
    
    The same problem was fixed for expiry dates in commit f7dcdf818b, bug
    
    Change-Id: I3ce83f53183cbd9003226466149f54e878749d1e
    Signed-off-by: Richard Mansfield <richard.mansfield@xxxxxxxxxxxxxxx>

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
https://bugs.launchpad.net/bugs/922031

Title:
  Suspended date time on a suspended user is not properly displayed when
  he tries to login

Status in Mahara ePortfolio:
  Fix Released

Bug description:
  Mahara master 1.5 dev from git, using MySQL on Linux

  When an user is suspended, its suspended date time is stored in table
  usr as a formatted string yyyy-mm-dd : hh:nn like in most other places
  of Mahara.

  But when the user tries to connect, the error message gives 'your
  account has been suspended on 1 january 1970 , 1:13  reason : ....'

  this is due to the fact that the function
  ensure_user_account_is_active() defined in auth/lib.php does not
  convert back the formatted datetime to an Unix timestamp before
  calling strftime function :

   $suspendedctime  = strftime(get_string('strftimedaydate'),
  $user->get('suspendedctime'));

  where it should be :

   $suspendedctime  = strftime(get_string('strftimedaydate'),
  strtotime($user->suspendedctime));

  This is likely due to the fact that at that moment the global variable $USER 
  still contains all its date informations as formatted strings and not yet as time stamps  (why ?)   as shown by this output of a print_r($USER) at the beginning of function ensure_user_account_is_active() :

              [logout_time] => 1327668801
              [id] => 5835
              [username] => ppollet2
              [password] => 3f9fbb213d671167a3de67eed512cb460f801ae0
              [salt] => 8ef00c74
              [passwordchange] => 0
              [active] => 1
              [deleted] => 0
              [expiry] => 
              [expirymailsent] => 0
              [lastlogin] => 2012-01-26 13:53:21       <---------
              [lastlastlogin] => 2012-01-26 12:25:57   <----------
              [lastaccess] => 2012-01-26 13:53:21      <-----------
              [inactivemailsent] => 0
              [staff] => 0
              [admin] => 0
              ....
              [profileicon] => 
              [suspendedctime] => 2012-01-26 11:03:09   <--------
              [suspendedreason] => doublon 
              [suspendedcusr] => 1
              [quota] => 5242880
              [quotaused] => 0
              [authinstance] => 1


  Attached a small patch against master ( 1.5dev)  where I also changed get_string('strftimedaydate' to
  get_string('strftimedaydatetime' to also display the time of suspension which is available

  according to a grep into all code , this should be fixed also in some
  other authentication plugins such as saml and xmlrpc

  [root@vm107-04 mahara]# grep -Rin strftimedaydate * |grep suspendedctime
  auth/lib.php:1417:        $suspendedctime  = strftime(get_string('strftimedaydate'), $user->get('suspendedctime'));
  auth/saml/lib.php:147:                die_info(get_string('accountsuspended', 'mahara', strftime(get_string('strftimedaydate'), $user->get('suspendedctime')), $user->get('suspendedreason')));
  auth/saml/index.php:583:        $suspendedctime  = strftime(get_string('strftimedaydate'), $USER->suspendedctime);
  auth/xmlrpc/lib.php:173:                die_info(get_string('accountsuspended', 'mahara', strftime(get_string('strftimedaydate'), $user->get('suspendedctime')), $user->get('suspendedreason')));

  Cheers

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/922031/+subscriptions


References