AbstractRule class update, with abstract authorized function updated to accept a parameter

This commit is contained in:
Dillon Ngo
2024-07-12 13:27:31 +08:00
parent 929cb2c0a6
commit c3961d102e
90 changed files with 92 additions and 92 deletions
@@ -10,7 +10,7 @@ use App\Classes\General\Interfaces\DataTransferObject;
abstract class AbstractRule
{
abstract protected function authorized(): bool;
abstract protected function authorized($object): bool;
abstract protected function validators($object): bool;
@@ -26,7 +26,7 @@ abstract class AbstractRule
*/
public function passes(?DataTransferObject $object = null): bool {
try {
if(!$this->authorized()){
if(!$this->authorized($object)){
throw new AccessForbiddenException('You don\'t have permission to perform this action');
}
@@ -43,4 +43,4 @@ abstract class AbstractRule
}
}
}