Implemented echoarea/filearea security
This commit is contained in:
29
app/Traits/AreaSecurity.php
Normal file
29
app/Traits/AreaSecurity.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Return the area security information
|
||||
*/
|
||||
namespace App\Traits;
|
||||
|
||||
trait AreaSecurity
|
||||
{
|
||||
public function getSecReadAttribute(): int
|
||||
{
|
||||
return ($this->security>>3) & 0x7;
|
||||
}
|
||||
|
||||
public function getSecWriteAttribute(): int
|
||||
{
|
||||
return $this->security & 0x7;
|
||||
}
|
||||
|
||||
public function setRead(int $security): void
|
||||
{
|
||||
$this->security = ($this->security & ~(0x7<<3)) | (($security & 0x7) << 3);
|
||||
}
|
||||
|
||||
public function setWrite(int $security): void
|
||||
{
|
||||
$this->security = ($this->security & ~(0x7)) | ($security & 0x7);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user