friendica/src/Domain/Entity/Permissionset.php

197 lines
3.6 KiB
PHP

<?php
/**
* @copyright Copyright (C) 2020, Friendica
*
* @license GNU APGL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Used to check/generate entities for the Friendica codebase
*/
declare(strict_types=1);
namespace Friendica\Domain\Entity;
use Friendica\BaseEntity;
use Friendica\Network\HTTPException\NotImplementedException;
/**
* Entity class for table permissionset
*/
class Permissionset extends BaseEntity
{
/**
* @var int
* sequential ID
*/
private $id;
/**
* @var int
* Owner id of this permission set
*/
private $uid = '0';
/**
* @var string
* Access Control - list of allowed contact.id '<19><78>'
*/
private $allowCid;
/**
* @var string
* Access Control - list of allowed groups
*/
private $allowGid;
/**
* @var string
* Access Control - list of denied contact.id
*/
private $denyCid;
/**
* @var string
* Access Control - list of denied groups
*/
private $denyGid;
/**
* {@inheritDoc}
*/
public function toArray()
{
return [
'id' => $this->id,
'uid' => $this->uid,
'allow_cid' => $this->allowCid,
'allow_gid' => $this->allowGid,
'deny_cid' => $this->denyCid,
'deny_gid' => $this->denyGid,
];
}
/**
* @return int
* Get sequential ID
*/
public function getId()
{
return $this->id;
}
/**
* @return int
* Get Owner id of this permission set
*/
public function getUid()
{
return $this->uid;
}
/**
* @param int $uid
* Set Owner id of this permission set
*/
public function setUid(int $uid)
{
$this->uid = $uid;
}
/**
* Get User
*
* @return User
*/
public function getUser()
{
//@todo use closure
throw new NotImplementedException('lazy loading for uid is not implemented yet');
}
/**
* @return string
* Get Access Control - list of allowed contact.id '<19><78>'
*/
public function getAllowCid()
{
return $this->allowCid;
}
/**
* @param string $allowCid
* Set Access Control - list of allowed contact.id '<19><78>'
*/
public function setAllowCid(string $allowCid)
{
$this->allowCid = $allowCid;
}
/**
* @return string
* Get Access Control - list of allowed groups
*/
public function getAllowGid()
{
return $this->allowGid;
}
/**
* @param string $allowGid
* Set Access Control - list of allowed groups
*/
public function setAllowGid(string $allowGid)
{
$this->allowGid = $allowGid;
}
/**
* @return string
* Get Access Control - list of denied contact.id
*/
public function getDenyCid()
{
return $this->denyCid;
}
/**
* @param string $denyCid
* Set Access Control - list of denied contact.id
*/
public function setDenyCid(string $denyCid)
{
$this->denyCid = $denyCid;
}
/**
* @return string
* Get Access Control - list of denied groups
*/
public function getDenyGid()
{
return $this->denyGid;
}
/**
* @param string $denyGid
* Set Access Control - list of denied groups
*/
public function setDenyGid(string $denyGid)
{
$this->denyGid = $denyGid;
}
}