diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-03-19 17:05:28 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-03-19 17:05:28 -0400 |
commit | b27a7db35465817afd54aa2af99446e9a13ffd76 (patch) | |
tree | 3a7950e2723249d36bf572593f1467a6e3c86d3c /app/Model/ProjectModel.php | |
parent | d915c2a96b0cbb54b9949cc04495d156e1f89332 (diff) |
Do not list private projects when adding a new user
Diffstat (limited to 'app/Model/ProjectModel.php')
-rw-r--r-- | app/Model/ProjectModel.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/app/Model/ProjectModel.php b/app/Model/ProjectModel.php index f59cae85..cabfee8a 100644 --- a/app/Model/ProjectModel.php +++ b/app/Model/ProjectModel.php @@ -202,16 +202,23 @@ class ProjectModel extends Base * Return the list of all projects * * @access public - * @param bool $prepend If true, prepend to the list the value 'None' + * @param bool $prependNone + * @param bool $noPrivateProjects * @return array */ - public function getList($prepend = true) + public function getList($prependNone = true, $noPrivateProjects = true) { - if ($prepend) { - return array(t('None')) + $this->db->hashtable(self::TABLE)->asc('name')->getAll('id', 'name'); + if ($noPrivateProjects) { + $projects = $this->db->hashtable(self::TABLE)->eq('is_private', 0)->asc('name')->getAll('id', 'name'); + } else { + $projects = $this->db->hashtable(self::TABLE)->asc('name')->getAll('id', 'name'); } - return $this->db->hashtable(self::TABLE)->asc('name')->getAll('id', 'name'); + if ($prependNone) { + return array(t('None')) + $projects; + } + + return $projects; } /** |