From f7e4c3928aba9cb7f5222cb4af67846312bbb435 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 14 Feb 2015 16:11:13 -0500 Subject: Refactoring/simplification of the pull-request about links --- app/Model/ProjectPermission.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/Model/ProjectPermission.php') diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermission.php index fb6316b6..cd892da4 100644 --- a/app/Model/ProjectPermission.php +++ b/app/Model/ProjectPermission.php @@ -337,6 +337,23 @@ class ProjectPermission extends Base ->findAllByColumn('projects.id'); } + /** + * Return a list of active project ids where the user is member + * + * @access public + * @param integer $user_id User id + * @return []integer + */ + public function getActiveMemberProjectIds($user_id) + { + return $this->db + ->table(Project::TABLE) + ->eq('user_id', $user_id) + ->eq(Project::TABLE.'.is_active', Project::ACTIVE) + ->join(self::TABLE, 'project_id', 'id') + ->findAllByColumn('projects.id'); + } + /** * Return a list of active projects where the user is member * -- cgit v1.2.3