•  
      request #7251 Send a reminder to project admins about the automatic cleanup of suspended LDAP users
    Infos
    #7251
    Ahmed HOSNI (hosniah)
    2014-09-19 11:16
    2014-07-22 10:44
    7261
    Details
    Send a reminder to project admins about the automatic cleanup of suspended LDAP users
    This artifact is linked to request #6545 and request #6570.
    We want to send a reminder notification to project admins one day before the automatic cleanup of Suspended user is performed.
    Authentication & LDAP
    All
    Empty
    • [x] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Ahmed HOSNI (hosniah)
    Closed
    2014-09-19
    Attachments
    Empty
    References

    Follow-ups

    User avatar
    Merged in 7.5.99.1

    Thanks for the contrib!

    • Status changed from Under implementation to Closed
    • Close date set to 2014-09-19
    User avatar
    Ahmed HOSNI (hosniah)2014-09-18 19:24
    Hello Manuel,

    It's fixed in patchset 16.
    Could you please give it a new try ?

    Regards,
    Ahmed
    User avatar
    I was missing the "being member of a project" part.

    So now I get the first mail but not the second one (seems expected based on your comment below). I let you fix it + the typo/cleanup before giving new try.

    Thanks
    User avatar
    Ahmed HOSNI (hosniah)2014-09-18 12:35
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes
    User avatar
    Ahmed HOSNI (hosniah)2014-09-18 12:34

    Hello Manuel,

    Sounds good, you should ensure that you are among project administrator of at least one project the user "yann" is member of.

    Basically you must receive 2 emails (one when suspending the user and another one as a reminder the day before the purge).

    For the second email, i've made a mistake within the dao, the method LDAP_DirectoryCleanUpDao::getUsersDeletedTomorrow() will retrieve users flagged with purge date between $today  and  $tomorrow:

            $today    = strtotime('today midnight');    
            $tomorrow = strtotime("+1 day", $today);

    Whith a var_dump and conversion from timestamp to human readable date, $today gives  "18/9/2014 à 0:00:00" and "19/9/2014 à 0:00:00" and that's why you don't  receive the reminder for the purge of user "yann" planned for tomorrow.

    However, the first email should be sent right after ldap user sync, the old feature would raise any failure to codendi_syslog (project with no admins, delivery issue, etc...). Is there any traces right there ?

     

    User avatar

    I continue the discussion about patchset 14 here because gerrit formatting sucks

    Basically, what I did:

    1. Everything is tested today (Sept 18th)
    2. Enable the deletion (set to 2d)
    3. Take one LDAP user (yann)
    4. As site admin, I modify his "ldap_id" to a non existant stuff
    5. As codendiadm, I ran codendi_daily
    6. The user got suspended and the DB looks like:
    mysql> select user_name, status, plugin_ldap_suspended_user.*, FROM_UNIXTIME(deletion_date) tbd_on from plugin_ldap_suspended_user JOIN user using (user_id);
    +----------------+--------+---------+---------------+---------------------+
    | user_name      | status | user_id | deletion_date | tbd_on              |
    +----------------+--------+---------+---------------+---------------------+
    | admin-gerrit28 | S      |     183 |    1411532201 | 2014-09-24 00:16:41 |
    | yann           | S      |     196 |    1411206375 | 2014-09-20 05:46:15 |
    +----------------+--------+---------+---------------+---------------------+
    2 rows in set (0.00 sec)


    So this is the expected behaviour, the user will be deleted in 2 days (Sept 20th).

    To test your patch, I modify the delete date to tomorrow (Sept 19th):
    
    mysql> update plugin_ldap_suspended_user set deletion_date = 1411206375 - 3600*24 where user_id = 196;
    Query OK, 1 row affected (0.03 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> select user_name, status, plugin_ldap_suspended_user.*, FROM_UNIXTIME(deletion_date) tbd_on from plugin_ldap_suspended_user JOIN user using (user_id);
    +----------------+--------+---------+---------------+---------------------+
    | user_name      | status | user_id | deletion_date | tbd_on              |
    +----------------+--------+---------+---------------+---------------------+
    | admin-gerrit28 | S      |     183 |    1411532201 | 2014-09-24 00:16:41 |
    | yann           | S      |     196 |    1411119975 | 2014-09-19 05:46:15 |
    +----------------+--------+---------+---------------+---------------------+
    2 rows in set (0.00 sec)

    But when I run codendi_daily, I get no email.

    What did I missed ?

     

     

    User avatar
    Ahmed HOSNI (hosniah)2014-07-22 10:47
    Review in gerrit #2520

    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes