Move to PermissionSet::isPublic()
This commit is contained in:
parent
caa977c24e
commit
bf224b58f8
2 changed files with 18 additions and 12 deletions
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Security\PermissionSet\Entity;
|
||||
|
||||
use Friendica\BaseEntity;
|
||||
use Friendica\Security\PermissionSet\Depository\PermissionSet as PermissionSetDepository;
|
||||
|
||||
/**
|
||||
* @property-read int|null $id
|
||||
|
@ -47,6 +48,21 @@ class PermissionSet extends BaseEntity
|
|||
$this->deny_gid = $deny_gid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, if the current PermissionSet is a/the public PermissionSet
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPublic(): bool
|
||||
{
|
||||
return (($this->id === PermissionSetDepository::PUBLIC) ||
|
||||
(is_null($this->id) &&
|
||||
empty($this->allow_cid) &&
|
||||
empty($this->allow_gid) &&
|
||||
empty($this->deny_cid) &&
|
||||
empty($this->deny_gid)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Entity with a new allowed_cid list (wipes the id because it isn't the same entity anymore)
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue