Skip to content

Commit

Permalink
Make it possible to retrieve a list of available users for authentica…
Browse files Browse the repository at this point in the history
…tion

refs #7163
  • Loading branch information
Johannes Meyer committed Sep 29, 2014
1 parent 7e00e83 commit 8fcf21a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions library/Icinga/Authentication/Backend/DbUserBackend.php
Expand Up @@ -126,4 +126,21 @@ public function count()

return ($row !== false) ? $row->count : 0;
}

/**
* Return the names of all available users
*
* @return array
*/
public function listUsers()
{
$query = $this->conn->select()->from('account', array('username'));

$users = array();
foreach ($query->fetchAll() as $row) {
$users[] = $row->username;
}

return $users;
}
}
17 changes: 17 additions & 0 deletions library/Icinga/Authentication/Backend/LdapUserBackend.php
Expand Up @@ -159,5 +159,22 @@ public function count()
)
);
}

/**
* Return the names of all available users
*
* @return array
*/
public function listUsers()
{
$query = $this->conn->select()->from($this->userClass, array($this->userNameAttribute));

$users = array();
foreach ($query->fetchAll() as $row) {
$users[] = $row->{$this->userNameAttribute};
}

return $users;
}
}

0 comments on commit 8fcf21a

Please sign in to comment.