Fixed error causing permissions to be deleted on book sort
Closes #282
Showing
2 changed files
with
2 additions
and
1 deletions
| ... | @@ -208,7 +208,7 @@ class BookController extends Controller | ... | @@ -208,7 +208,7 @@ class BookController extends Controller |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | // Update permissions on changed models | 210 | // Update permissions on changed models |
| 211 | - $this->entityRepo->buildJointPermissions($updatedModels); | 211 | + if (count($updatedModels) === 0) $this->entityRepo->buildJointPermissions($updatedModels); |
| 212 | 212 | ||
| 213 | return redirect($book->getUrl()); | 213 | return redirect($book->getUrl()); |
| 214 | } | 214 | } | ... | ... |
| ... | @@ -243,6 +243,7 @@ class PermissionService | ... | @@ -243,6 +243,7 @@ class PermissionService |
| 243 | */ | 243 | */ |
| 244 | protected function deleteManyJointPermissionsForEntities($entities) | 244 | protected function deleteManyJointPermissionsForEntities($entities) |
| 245 | { | 245 | { |
| 246 | + if (count($entities) === 0) return; | ||
| 246 | $query = $this->jointPermission->newQuery(); | 247 | $query = $this->jointPermission->newQuery(); |
| 247 | foreach ($entities as $entity) { | 248 | foreach ($entities as $entity) { |
| 248 | $query->orWhere(function($query) use ($entity) { | 249 | $query->orWhere(function($query) use ($entity) { | ... | ... |
-
Please register or sign in to post a comment