Add PUBLIC constant in Repository\Permission

This commit is contained in:
Hypolite Petovan 2020-01-22 19:42:14 -05:00
parent e8bf74914b
commit 02dda8af9b

View file

@ -13,6 +13,8 @@ use Psr\Log\LoggerInterface;
class PermissionSet extends BaseRepository class PermissionSet extends BaseRepository
{ {
const PUBLIC = 0;
protected static $table_name = 'permissionset'; protected static $table_name = 'permissionset';
protected static $model_class = Model\PermissionSet::class; protected static $model_class = Model\PermissionSet::class;
@ -47,7 +49,7 @@ class PermissionSet extends BaseRepository
{ {
if (isset($condition['id']) && !$condition['id']) { if (isset($condition['id']) && !$condition['id']) {
return $this->create([ return $this->create([
'id' => 0, 'id' => self::PUBLIC,
'uid' => $condition['uid'] ?? 0, 'uid' => $condition['uid'] ?? 0,
'allow_cid' => '', 'allow_cid' => '',
'allow_gid' => '', 'allow_gid' => '',
@ -109,7 +111,7 @@ class PermissionSet extends BaseRepository
// Public permission // Public permission
if (!$allow_cid && !$allow_gid && !$deny_cid && !$deny_gid) { if (!$allow_cid && !$allow_gid && !$deny_cid && !$deny_gid) {
return 0; return self::PUBLIC;
} }
$condition = [ $condition = [