getUserIdsByRole() public method

Returns all user IDs assigned to the role specified.
Since: 2.0.7
public getUserIdsByRole ( string $roleName ) : array
$roleName string
return array array of user ID strings
 public function testGetAssignmentsByRole()
 {
     $this->prepareData();
     $reader = $this->auth->getRole('reader');
     $this->auth->assign($reader, 123);
     $this->auth = $this->createManager();
     $this->assertEquals([], $this->auth->getUserIdsByRole('nonexisting'));
     $this->assertEquals(['reader A', '123'], $this->auth->getUserIdsByRole('reader'));
     $this->assertEquals(['author B'], $this->auth->getUserIdsByRole('author'));
     $this->assertEquals(['admin C'], $this->auth->getUserIdsByRole('admin'));
 }
 /**
  * Remove roles.
  */
 protected function removeRoles()
 {
     if (!($roles = ArrayHelper::getValue($this->rbac, 'roles'))) {
         return;
     }
     foreach ($roles as $name => $children) {
         if (!($role = $this->_auth->getRole($name))) {
             continue;
         }
         foreach ($children as $childName) {
             if ($permission = ArrayHelper::getValue($this->_permissions, $childName)) {
                 $this->_auth->removeChild($role, $permission);
             } elseif ($childRole = $this->_auth->getRole($childName)) {
                 $this->_auth->removeChild($role, $childRole);
             }
         }
         $this->_auth->remove($role);
         $userIds = $this->_auth->getUserIdsByRole($name);
         foreach ($userIds as $userId) {
             $this->_auth->revoke($role, $userId);
         }
     }
 }