Skip to content

Commit 0baf21d

Browse files
authored
Merge branch 'master' into hotfix/CAES-1708
2 parents 66d56a8 + b0aa031 commit 0baf21d

File tree

6 files changed

+13
-7
lines changed

6 files changed

+13
-7
lines changed

.drone.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ globals:
191191
steps:
192192
- <<: *stepCheckBuild
193193
when:
194-
branch: [feature/*]
194+
branch: [feature/*, hotfix/*]
195195
event: [push]
196196

197197
- <<: *stepMainBuild
@@ -223,6 +223,7 @@ trigger:
223223
- master
224224
- develop
225225
- feature/*
226+
- hotfix/*
226227
event:
227228
- tag
228229
- push

src/Security/Voter/ListVoter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private function canCreate(User $user)
8080

8181
private function canEdit(Directory $subject, User $user): bool
8282
{
83-
return $this->canSort($subject, $user);
83+
return $this->canSort($subject, $user) && Directory::LIST_DEFAULT !== $subject->getLabel();
8484
}
8585

8686
private function canDelete(Directory $subject, User $user): bool

src/Security/Voter/TeamListVoter.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private function canEdit(Directory $subject, User $user): bool
130130
return false;
131131
}
132132

133-
return $userTeam->hasRole(UserTeam::USER_ROLE_ADMIN);
133+
return $userTeam->hasRole(UserTeam::USER_ROLE_ADMIN) && Directory::LIST_DEFAULT !== $subject->getLabel();
134134
}
135135

136136
private function canDelete(Directory $subject, User $user): bool
@@ -140,7 +140,12 @@ private function canDelete(Directory $subject, User $user): bool
140140

141141
private function canSort(Directory $subject, User $user): bool
142142
{
143-
return $this->canEdit($subject, $user);
143+
$userTeam = $subject->getTeam()->getUserTeamByUser($user);
144+
if (null === $userTeam) {
145+
return false;
146+
}
147+
148+
return $userTeam->hasRole(UserTeam::USER_ROLE_ADMIN);
144149
}
145150

146151
private function isMovable(Directory $subject, User $user): bool

tests/api/Team/ListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function editList()
123123
$this->editListValidate($teamAdmin, $list);
124124
$this->canEditTeamList($teamAdmin, $list, self::DEFAULT_LIST_NAME);
125125
$this->canEditTeamList($domainAdmin, $list, uniqid());
126-
$this->canEditTeamList($teamAdmin, $team->getDefaultDirectory(), uniqid());
126+
$this->cantAccessToEditTeamList($teamAdmin, $team->getDefaultDirectory(), uniqid());
127127
$this->cantAccessToEditTeamList($superAdmin, $list);
128128
$this->cantAccessToEditTeamList($member, $list);
129129
$this->cantAccessToEditTeamList($teamAdmin, $otherList);

tests/api/Team/PermissionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private function canAccessToList(User $user, Team $team)
241241
$I->seeResponseByJsonPathContainsJson(sprintf('$[?(@.type=="%s")]', DirectoryEnumType::DEFAULT), ['_links' => [
242242
'team_create_item' => [],
243243
'team_sort_list' => [],
244-
'team_edit_list' => [],
244+
//'team_edit_list' => [],
245245
]]);
246246
$I->dontSeeResponseByJsonPathContainsJson(sprintf('$[?(@.type=="%s")]', DirectoryEnumType::DEFAULT), ['_links' => [
247247
'team_delete_list' => [],

tests/api/User/PermissionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function listPermission()
4545
$I->seeResponseByJsonPathContainsJson(sprintf('$[?(@.label=="%s")]', DirectoryEnumType::DEFAULT), ['_links' => [
4646
'sort_list' => [],
4747
'create_item' => [],
48-
'edit_list' => [],
48+
//'edit_list' => [],
4949
]]);
5050
$I->dontSeeResponseByJsonPathContainsJson(sprintf('$[?(@.label=="%s")]', DirectoryEnumType::DEFAULT), ['_links' => [
5151
'delete_list' => [],

0 commit comments

Comments
 (0)