Ensure dead users are not displayed in X.net directories. Moreover, since
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 3 Oct 2010 15:15:28 +0000 (17:15 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 3 Oct 2010 15:15:28 +0000 (17:15 +0200)
promotion groups are built at 'user addition in db' time, do not show not
registered users in this groups.

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/group.php
classes/user.php

index e3f3b62..b5f4500 100644 (file)
 
 class Group
 {
+    const CAT_GROUPESX     = "GroupesX";
+    const CAT_BINETS       = "Binets";
+    const CAT_PROMOTIONS   = "Promotions";
+    const CAT_INSTITUTIONS = "Institutions";
+
     public $id;
     public $shortname;
     private $data = array();
@@ -54,9 +59,12 @@ class Group
 
     private function getUF($admin = false, $extra_cond = null, $sort = null)
     {
-        $cond = new UFC_Group($this->id, $admin);
+        $cond = new PFC_And(new UFC_Group($this->id, $admin), new PFC_Not(new UFC_Dead()));
         if (!is_null($extra_cond)) {
-            $cond = new PFC_And($cond, $extra_cond);
+            $cond->addChild($extra_cond);
+        }
+        if ($this->cat == self::CAT_PROMOTIONS) {
+            $cond->addChild(new UFC_Registered());
         }
         return new UserFilter($cond, $sort);
     }
index 82c41f4..ea182ef 100644 (file)
@@ -611,7 +611,7 @@ class User extends PlUser
             $result = array();
             foreach ($this->groups as $id=>$data) {
                 if ($institutions) {
-                    if ($data['cat'] != 'GroupesX' && $data['cat'] != 'Institutions') {
+                    if ($data['cat'] != Goup::CAT_GROUPESX && $data['cat'] != Group::CAT_INSTITUTIONS) {
                         continue;
                     }
                 }