9794: new students are not in the students group
authorsstamer <s.stamer@metaways.de>
Thu, 20 Mar 2014 12:49:42 +0000 (13:49 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 20 Mar 2014 20:06:42 +0000 (21:06 +0100)
https://forge.tine20.org/mantisbt/view.php?id=9794

- fix student_group

Change-Id: I7927f20b156e24b9f71c1b96e4177f791f1d7ab7
Reviewed-on: http://gerrit.tine20.com/customers/457
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Courses/JsonTest.php
tine20/Courses/Controller/Course.php

index 88ac825..6be571b 100644 (file)
@@ -366,11 +366,14 @@ class Courses_JsonTest extends TestCase
         $this->assertEquals('/bin/false', $newUser->accountLoginShell);
         
         $newUserMemberships = Tinebase_Group::getInstance()->getGroupMemberships($newUser);
-        $this->assertEquals(3, count($newUserMemberships), 'new user should have 3 group memberships');
+        
+        $this->assertEquals(4, count($newUserMemberships), 'new user should have 4 group memberships');
         $this->assertTrue(in_array(Tinebase_Group::getInstance()->getDefaultGroup()->getId(), $newUserMemberships),
             'could not find default group in memberships: ' . print_r($newUserMemberships, TRUE));
         $this->assertTrue(in_array($this->_configGroups[Courses_Config::INTERNET_ACCESS_GROUP_ON]->getId(), $newUserMemberships),
             $id . ' not member of the internet group ' . print_r($newUserMemberships, TRUE));
+        $this->assertTrue(in_array($this->_configGroups[Courses_Config::STUDENTS_GROUP]->getId(), $newUserMemberships),
+            $id . ' not member of the students group ' . print_r($newUserMemberships, TRUE));
     }
     
     /**
index 34418f1..fc957db 100644 (file)
@@ -526,6 +526,7 @@ class Courses_Controller_Course extends Tinebase_Controller_Record_Abstract
         // add to default group and manage access group for user
         $this->_groupController->addGroupMember(Tinebase_Group::getInstance()->getDefaultGroup()->getId(), $newMember->getId());
         $this->_manageAccessGroups(array($newMember->getId()), $course);
+        $this->_addToStudentGroup(array($newMember->getId()));
         
         return $newMember;
     }