Browse Source

Merge pull request #4 from discoverygarden/ctda9-67

[CTDA9-67] Check update operation in access controller.
pull/5/head v1.0.0
Noel Chiasson 3 years ago committed by GitHub
parent
commit
f481b9a328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/FixityCheckAccessControlHandler.php
  2. 5
      src/FixityCheckBatchCheck.php
  3. 2
      src/FixityCheckServiceInterface.php

1
src/FixityCheckAccessControlHandler.php

@ -24,6 +24,7 @@ class FixityCheckAccessControlHandler extends EntityAccessControlHandler {
case 'view revision': case 'view revision':
return AccessResult::allowedIfHasPermission($account, 'view fixity checks')->cachePerPermissions(); return AccessResult::allowedIfHasPermission($account, 'view fixity checks')->cachePerPermissions();
case 'update':
case 'delete': case 'delete':
return AccessResult::allowedIfHasPermission($account, $admin_permission)->cachePerPermissions(); return AccessResult::allowedIfHasPermission($account, $admin_permission)->cachePerPermissions();

5
src/FixityCheckBatchCheck.php

@ -179,7 +179,7 @@ class FixityCheckBatchCheck {
} }
$files = $storage->getPeriodic($sandbox['offset'], $batch_size); $files = $storage->getPeriodic($sandbox['offset'], $batch_size);
$end = min($sandbox['total'], $sandbox['offset'] + count($files)); $end = min($sandbox['remaining'], $sandbox['offset'] + count($files));
$context['message'] = \t('Processing @start to @end', [ $context['message'] = \t('Processing @start to @end', [
'@start' => $sandbox['offset'], '@start' => $sandbox['offset'],
'@end' => $end, '@end' => $end,
@ -219,6 +219,9 @@ class FixityCheckBatchCheck {
if ($result->passed()) { if ($result->passed()) {
$results['successful']++; $results['successful']++;
} }
else {
$results['failed']++;
}
} }
else { else {
// The check was not performed as the time elapsed since the last // The check was not performed as the time elapsed since the last

2
src/FixityCheckServiceInterface.php

@ -100,7 +100,7 @@ interface FixityCheckServiceInterface {
* elapsed since the last check has not exceed the required threshold. * elapsed since the last check has not exceed the required threshold.
* *
* @return \Drupal\dgi_fixity\Entity\FixityCheckInterface|null * @return \Drupal\dgi_fixity\Entity\FixityCheckInterface|null
* The resulting fixity_check if successful. * The resulting fixity_check if performed.
* NULL if the check was not performed because the time elapsed since the * NULL if the check was not performed because the time elapsed since the
* last check has not exceed the required threshold. * last check has not exceed the required threshold.
*/ */

Loading…
Cancel
Save