Skip to content

Commit

Permalink
Added extraPermission check for model class
Browse files Browse the repository at this point in the history
  • Loading branch information
riteshjha authored Jun 7, 2023
1 parent 779bd6f commit 2a596f9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Models/Traits/HasPermission.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function hasPermission($authUser, $ability, $level)
$result = $this->isOwner($authUser, $ability, $level);
}

return $result;
return $this->extraPermission($result, $ability, $level);
}

/**
Expand Down Expand Up @@ -177,4 +177,17 @@ protected function isAccountOwner($authUser)

return $this->owner->{$accountId} == $authUser->{$accountId};
}

/**
* This method can be used to extend the permission check in model class
*
* @param boolean $result
* @param string $ability
* @param int $level
* @return boolean
*/
protected function extraPermission($result, $ability, $level)
{
return $result;
}
}

0 comments on commit 2a596f9

Please sign in to comment.