Merge branch 'patch-1' of github.com:toomyem/kanboard
This commit is contained in:
commit
5d9b5aee6d
|
|
@ -82,6 +82,15 @@ class Project extends Base
|
|||
|
||||
if ($nb_users < 1) return true;
|
||||
|
||||
// check if user has admin rights
|
||||
$nb_users = $this->db
|
||||
->table(\Model\User::TABLE)
|
||||
->eq('id', $user_id)
|
||||
->eq('is_admin', 1)
|
||||
->count();
|
||||
|
||||
if ($nb_users > 0) return true;
|
||||
|
||||
// Otherwise, allow only specific users
|
||||
return (bool) $this->db
|
||||
->table(self::TABLE_USERS)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,13 @@ class ProjectTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertTrue($p->revokeUser(1, 1));
|
||||
|
||||
$this->assertEquals(array('2' => 'unittest'), $p->getAllowedUsers(1));
|
||||
$this->assertFalse($p->isUserAllowed(1, 1));
|
||||
$this->assertTrue($p->isUserAllowed(1, 1)); // has admin priviledges
|
||||
$this->assertTrue($p->isUserAllowed(1, 2));
|
||||
|
||||
// Check if revoked regular user is not allowed
|
||||
$this->assertTrue($p->allowUser(1, 1));
|
||||
$this->assertTrue($p->revokeUser(1, 2));
|
||||
$this->assertEquals(array('1' => 'admin'), $p->getAllowedUsers(1));
|
||||
$this->assertFalse($p->isUserAllowed(1, 2)); // regulat user is not allowed
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue