Regular users are able to create private projects
This commit is contained in:
@@ -142,12 +142,10 @@ class ProjectPermission extends Base
|
||||
*/
|
||||
public function isUserAllowed($project_id, $user_id)
|
||||
{
|
||||
// Check if the user has admin rights
|
||||
if ($this->user->isAdmin($user_id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, allow only specific users
|
||||
return (bool) $this->db
|
||||
->table(self::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
@@ -155,6 +153,23 @@ class ProjectPermission extends Base
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a specific user is allowed to manage a project
|
||||
*
|
||||
* @access public
|
||||
* @param integer $project_id Project id
|
||||
* @param integer $user_id User id
|
||||
* @return bool
|
||||
*/
|
||||
public function adminAllowed($project_id, $user_id)
|
||||
{
|
||||
if ($this->isUserAllowed($project_id, $user_id) && $this->project->isPrivate($project_id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter a list of projects for a given user
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user