From: Stéphane Jacob Date: Sat, 19 Mar 2011 17:53:09 +0000 (+0100) Subject: Disable xnet accounts when they have no group left. X-Git-Tag: xorg/1.1.0~26^2~11 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=8d0145763239d5d4ac8ec995523da558763b0da1;p=platal.git Disable xnet accounts when they have no group left. Signed-off-by: Stéphane Jacob --- diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 6a610a4..9126b90 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -888,11 +888,10 @@ class XnetGrpModule extends PLModule } else { $page->trigWarning('Tu as été désinscrit du groupe, mais des erreurs se sont produites lors des désinscriptions des alias et des listes de diffusion.'); } - if ($user->type == 'xnet' && $hasSingleGroup && Post::has('accountDeletion')) { - XDB::execute('DELETE FROM acounts - WHERE uid = {?}', - $user->id()); - $page->trigSuccess('Ton compte a bien été supprimé.'); + + // If user is of type xnet account and this was her last group, disable the account. + if ($user->type == 'xnet' && $hasSingleGroup) { + $user->clear(true); } $page->assign('is_member', is_member(true)); } @@ -928,24 +927,9 @@ class XnetGrpModule extends PLModule $page->trigWarning("{$user->fullName()} a été désinscrit du groupe, mais des erreurs subsistent !"); } - // Either deletes or notifies site administrators if it was the last group - // of a xnet account. + // If user is of type xnet account and this was her last group, disable the account. if ($user->type == 'xnet' && $hasSingleGroup) { - if ($user->state == 'pending') { - // If the user has never logged in the site, we delete her account. - XDB::execute('DELETE FROM acounts - WHERE uid = {?}', - $user->id()); - } else { - // It the user has already logged in the site, we notify site - // administrators that there is a new xnet account without any - // group. - $mailer = new PlMailer('xnetgrp/unsubscription.mail.tpl'); - $mailer->assign('user', $user); - $mailer->assign('groupId', $globals->asso('id')); - $mailer->assign('groupName', $globals->asso('nom')); - $mailer->send(); - } + $user->clear(true); } } diff --git a/templates/xnetgrp/membres-del.tpl b/templates/xnetgrp/membres-del.tpl index b2c0df2..004a356 100644 --- a/templates/xnetgrp/membres-del.tpl +++ b/templates/xnetgrp/membres-del.tpl @@ -46,12 +46,6 @@ {if $self} Êtes-vous sûr de vouloir vous désinscrire du groupe {$asso->nom} et de toutes les listes de diffusion associées ? - {if $user->type eq 'xnet' && $user->groupCount() eq 1} -
C'est le seul groupe auquel tu es actuellement inscrit sur polytechnique.net. - Si, malgré cela, tu souhaites garder ton accès à Polytechnique.net, décoche la case - ci-dessous.
- - {/if} {else} Êtes-vous sûr de vouloir supprimer {$user->fullName()} du groupe, lui retirer tous les droits associés à son statut de membre