Fix for AreaSecurity when presented security is null

This commit is contained in:
Deon George 2024-04-26 16:27:15 +10:00
parent e9895aee45
commit 9abfd88e3d

View File

@ -13,7 +13,7 @@ trait AreaSecurity
* @param int $sec * @param int $sec
* @return bool * @return bool
*/ */
public function can_access(int $sec): bool public function can_access(?int $sec): bool
{ {
return $this->can_read($sec) || $this->can_write($sec); return $this->can_read($sec) || $this->can_write($sec);
} }
@ -24,7 +24,7 @@ trait AreaSecurity
* @param int $sec * @param int $sec
* @return bool * @return bool
*/ */
public function can_read(int $sec): bool public function can_read(?int $sec): bool
{ {
return $this->active && (($sec >= ($x=$this->getSecReadAttribute())) && $x); return $this->active && (($sec >= ($x=$this->getSecReadAttribute())) && $x);
} }
@ -35,7 +35,7 @@ trait AreaSecurity
* @param int $sec * @param int $sec
* @return bool * @return bool
*/ */
public function can_write(int $sec): bool public function can_write(?int $sec): bool
{ {
return $this->active && (($sec >= ($x=$this->getSecWriteAttribute())) && $x); return $this->active && (($sec >= ($x=$this->getSecWriteAttribute())) && $x);
} }