support multiple teamleads in each team (#2702)

* fix jumping avatars
* fix line-break after color dot for long names
This commit is contained in:
Kevin Papst
2021-08-07 18:05:41 +02:00
committed by GitHub
parent e9986c92d6
commit b2d3272151
101 changed files with 1952 additions and 649 deletions

View File

@@ -75,10 +75,10 @@ abstract class AbstractVoterTest extends TestCase
$rateOther = ['view_rate_other_timesheet', 'edit_rate_other_timesheet'];
$teams = ['view_team', 'create_team', 'edit_team', 'delete_team'];
$roleUser = ['edit_team_activity', 'edit_team_project', 'edit_team_customer'];
$roleTeamlead = ['view_rate_own_timesheet', 'view_rate_other_timesheet', 'hourly-rate_own_profile'];
$roleAdmin = ['hourly-rate_own_profile', 'edit_exported_timesheet'];
$roleSuperAdmin = ['hourly-rate_own_profile', 'hourly-rate_other_profile', 'roles_own_profile', 'system_information', 'system_configuration', 'plugins', 'edit_exported_timesheet'];
$roleUser = ['view_team_member', 'edit_team_activity', 'edit_team_project', 'edit_team_customer'];
$roleTeamlead = ['view_team_member', 'view_rate_own_timesheet', 'view_rate_other_timesheet', 'hourly-rate_own_profile'];
$roleAdmin = ['view_team_member', 'hourly-rate_own_profile', 'edit_exported_timesheet'];
$roleSuperAdmin = ['view_team_member', 'hourly-rate_own_profile', 'hourly-rate_other_profile', 'roles_own_profile', 'system_information', 'system_configuration', 'plugins', 'edit_exported_timesheet'];
$permissions = [
'ROLE_USER' => array_merge($timesheet, $profile, $roleUser),

View File

@@ -90,7 +90,7 @@ class ActivityVoterTest extends AbstractVoterTest
$team = new Team();
$user = new User();
$user->addRole(User::ROLE_TEAMLEAD);
$team->setTeamLead($user);
$team->addTeamlead($user);
$activity = new Activity();
$project = new Project();
@@ -129,7 +129,7 @@ class ActivityVoterTest extends AbstractVoterTest
$team = new Team();
$user = new User();
$user->addRole(User::ROLE_USER);
$team->setTeamLead($user);
$team->addTeamlead($user);
$activity = new Activity();
$project = new Project();

View File

@@ -47,7 +47,7 @@ class CustomerVoterTest extends AbstractVoterTest
}
$team = new Team();
$team->setTeamLead($userTeamlead);
$team->addTeamlead($userTeamlead);
foreach ([$userTeamlead] as $user) {
$customer = new Customer();
$team->addCustomer($customer);
@@ -88,7 +88,7 @@ class CustomerVoterTest extends AbstractVoterTest
$team = new Team();
$user = new User();
$user->addRole(User::ROLE_TEAMLEAD);
$team->setTeamLead($user);
$team->addTeamlead($user);
$customer = new Customer();
$customer->addTeam($team);
@@ -101,7 +101,7 @@ class CustomerVoterTest extends AbstractVoterTest
$team = new Team();
$user = new User();
$user->addRole(User::ROLE_USER);
$team->setTeamLead($user);
$team->addTeamlead($user);
$customer = new Customer();
$customer->addTeam($team);

View File

@@ -52,7 +52,7 @@ class ProjectVoterTest extends AbstractVoterTest
}
$team = new Team();
$team->setTeamLead($userTeamlead);
$team->addTeamlead($userTeamlead);
foreach ([$userTeamlead] as $user) {
$project = new Project();
$team->addProject($project);
@@ -95,7 +95,7 @@ class ProjectVoterTest extends AbstractVoterTest
$team = new Team();
$user = new User();
$user->addRole(User::ROLE_TEAMLEAD);
$team->setTeamLead($user);
$team->addTeamlead($user);
$project = new Project();
$customer = new Customer();
@@ -117,7 +117,7 @@ class ProjectVoterTest extends AbstractVoterTest
$team = new Team();
$user = new User();
$user->addRole(User::ROLE_USER);
$team->setTeamLead($user);
$team->addTeamlead($user);
$project = new Project();
$customer = new Customer();

View File

@@ -111,4 +111,16 @@ class UserVoterTest extends AbstractVoterTest
[User::AUTH_SAML, VoterInterface::ACCESS_DENIED],
];
}
public function testViewTeamMember()
{
$userMock = $this->createMock(User::class);
$userMock->method('getId')->willReturn(1);
$user = new User();
$token = new UsernamePasswordToken($user, 'foo', 'bar', $user->getRoles());
$sut = $this->getVoter(UserVoter::class);
$this->assertEquals(VoterInterface::ACCESS_GRANTED, $sut->vote($token, $user, ['view_team_member']));
$this->assertEquals(VoterInterface::ACCESS_DENIED, $sut->vote($token, $userMock, ['view_team_member']));
}
}