Skip to content

Commit 293f4e5

Browse files
committed
Fixed hash calculation
1 parent 5723f92 commit 293f4e5

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

  • core/components/fileman/src/Processors/File

core/components/fileman/src/Processors/File/Hash.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
namespace FileMan\Processors\File;
44

5-
use MODX\Revolution\Processors\Model\GetProcessor;
65
use FileMan\Model\File;
7-
use MODX\Revolution\Processors\ModelProcessor;
6+
use MODX\Revolution\Processors\Model\UpdateProcessor;
87

9-
class Hash extends ModelProcessor
8+
class Hash extends UpdateProcessor
109
{
1110
public $objectType = 'File';
1211
public $classKey = File::class;
@@ -17,22 +16,14 @@ class Hash extends ModelProcessor
1716
public $object;
1817

1918
/**
20-
* We doing special check of permission
21-
* because of our objects is not an instances of modAccessibleObject
22-
*
23-
* @return mixed
19+
* @return bool
2420
*/
25-
public function process()
21+
public function beforeSet()
2622
{
27-
if (!$this->checkPermissions()) {
28-
return $this->failure($this->modx->lexicon('access_denied'));
29-
}
30-
3123
$hash = sha1($this->object->getFullPath());
3224

33-
$this->object->set('hash', $hash);
34-
$this->object->save();
25+
$this->setProperty('hash', $hash);
3526

36-
return $this->success('', array('hash' => $hash));
27+
return parent::beforeSet();
3728
}
3829
}

0 commit comments

Comments
 (0)