Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
lianguan committed Dec 11, 2017
1 parent 689ae85 commit 8566168
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/Http/Controllers/Manage/ProjectPermissionController.php
Expand Up @@ -89,7 +89,9 @@ public function addUser()
public function removeUser()
{
$project = $this->getProject();
$user = $this->projectUserRoleModel->getRemoveUser();
$values = $this->request->getValues();

$user = $this->projectUserRoleModel->getRemoveUser($values['project_id'], $values['user_id']);

if ($this->request->isPost()) {
$this->request->checkCSRFToken();
Expand Down
14 changes: 11 additions & 3 deletions app/Models/ProjectUserRoleModel.php
Expand Up @@ -228,15 +228,23 @@ public function addUser($project_id, $user_id, $role)
]);
}

public function getRemoveUser()
/**
* Remove a user.
*
* @param int $project_id
* @param int $user_id
*
* @return array
*/
public function getRemoveUser($project_id, $user_id)
{
$user = $this->userModel->getById($this->request->getIntegerParam('user_id'));
$user = $this->userModel->getById($user_id);

if (empty($user)) {
throw new PageNotFoundException();
}

$role = $this->getUserRole($this->request->getIntegerParam('project_id', 0), $this->userSession->getId());
$role = $this->getUserRole($project_id, $this->userSession->getId());

if (!$this->userSession->isAdmin() && $role != Role::PROJECT_MANAGER) {
throw new AccessForbiddenException();
Expand Down

0 comments on commit 8566168

Please sign in to comment.