Fix bugs, improve perfs and use SimpleLogger instead of Monolog

This commit is contained in:
Frédéric Guillot
2015-01-02 17:19:13 -05:00
parent c32567857d
commit 3076ba22dd
39 changed files with 288 additions and 139 deletions

View File

@@ -298,7 +298,11 @@ class ProjectPermission extends Base
*/
public function getAllowedProjects($user_id)
{
return $this->filterProjects($this->project->getListByStatus(Project::ACTIVE), $user_id, 'isUserAllowed');
if ($this->user->isAdmin($user_id)) {
return $this->project->getListByStatus(Project::ACTIVE);
}
return $this->getMemberProjects($user_id);
}
/**
@@ -310,7 +314,11 @@ class ProjectPermission extends Base
*/
public function getMemberProjects($user_id)
{
return $this->filterProjects($this->project->getListByStatus(Project::ACTIVE), $user_id, 'isMember');
return $this->db
->table(Project::TABLE)
->eq('user_id', $user_id)
->join(self::TABLE, 'project_id', 'id')
->listing('projects.id', 'name');
}
/**