public function getInstalledTargetItems(Batch $batch)
 {
     $ul = new UserList();
     $ul->sortByUserName();
     $users = $ul->getResults();
     $items = array();
     foreach ($users as $user) {
         $item = new TargetItem($this);
         $item->setItemId($user->getUserID());
         $item->setItemName($user->getUserDisplayName());
         $items[] = $item;
     }
     return $items;
 }
 public function reset_passwords()
 {
     if (!$this->validateForm()) {
         return;
     }
     \Core::make('config/database')->save(self::PASSWORD_RESET_MESSAGE_KEY, $this->post('resetMessage'));
     $users = new UserList();
     foreach ($users->getResults() as $userInfo) {
         if ($userInfo instanceof UserInfo) {
             $userInfo->resetUserPassword();
             $userInfo->markAsPasswordReset();
         }
     }
     $this->redirect('/');
 }
Exemple #3
0
 public function testGroups()
 {
     $u = \User::getByUserID(2);
     $g = Group::add('Test Group', 'Test Group');
     $u->enterGroup($g);
     $this->list->filterByGroup($g);
     $this->assertEquals(1, $this->list->getTotalResults());
     $pagination = $this->list->getPagination();
     $this->assertEquals(1, $pagination->getTotalResults());
     $results = $pagination->getCurrentPageResults();
     $this->assertInstanceOf('\\Concrete\\Core\\User\\UserInfo', $results[0]);
     $this->assertEquals('testuser2', $results[0]->getUserName());
     $nl = new UserList();
     $nl->filterByGroup($g, false);
     $nl->sortByUserID();
     $this->assertEquals(2, $nl->getTotalResults());
     $results = $nl->getResults();
     $this->assertEquals('testuser', $results[0]->getUserName());
     $this->assertEquals('andrew', $results[1]->getUserName());
 }
Exemple #4
0
 public function testAutomatedGroupsBase()
 {
     require_once dirname(__FILE__) . '/fixtures/TestGroup.php';
     $g = Group::add('Test Group', '');
     // gonna pull all users with vowels in their names in this group.
     $g->setAutomationOptions(true, false, false);
     $groupControllers = \Group::getAutomatedOnRegisterGroupControllers();
     $this->assertEquals(1, count($groupControllers));
     $users = array(array('aembler', '*****@*****.**'), array('ffjdhbn', '*****@*****.**'), array('ffbOkj', '*****@*****.**'), array('kkytnz', '*****@*****.**'), array('zzvnv', '*****@*****.**'), array('qqwenz', '*****@*****.**'), array('mmnvb', '*****@*****.**'));
     foreach ($users as $user) {
         $this->createUser($user[0], $user[1]);
     }
     $ul = new UserList();
     $ul->filterByGroupID($g->getGroupID());
     $ul->sortByUserName();
     $users1 = $ul->getResults();
     $ul = new UserList();
     $ul->filterByNoGroup();
     $ul->sortByUserName();
     $users2 = $ul->getResults();
     $this->assertEquals(3, count($users1));
     $this->assertEquals(4, count($users2));
 }
 /** Returns a full array of results. */
 public function getResults()
 {
     return parent::getResults();
 }