mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-12-06 11:22:41 +01:00
added resource members
This commit is contained in:
parent
851fa0a1cc
commit
92c431e856
14 changed files with 311 additions and 20 deletions
50
lib/Db/ResourceMember.php
Normal file
50
lib/Db/ResourceMember.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\OrganizationFolders\Db;
|
||||
|
||||
use JsonSerializable;
|
||||
use OCA\OrganizationFolders\Interface\TableSerializable;
|
||||
|
||||
use OCP\AppFramework\Db\Entity;
|
||||
|
||||
use OCA\OrganizationFolders\Enum\MemberPermissionLevel;
|
||||
use OCA\OrganizationFolders\Enum\MemberType;
|
||||
|
||||
class ResourceMember extends Entity implements JsonSerializable, TableSerializable {
|
||||
protected $resourceId;
|
||||
protected $permissionLevel;
|
||||
protected $type;
|
||||
protected $principal;
|
||||
protected $createdTimestamp;
|
||||
protected $lastUpdatedTimestamp;
|
||||
|
||||
public function __construct() {
|
||||
$this->addType('resourceId','integer');
|
||||
$this->addType('permissionLevel','integer');
|
||||
$this->addType('type','integer');
|
||||
$this->addType('createdTimestamp','integer');
|
||||
$this->addType('lastUpdatedTimestamp','integer');
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'resourceId' => $this->resourceId,
|
||||
'permissionLevel' => $this->permissionLevel,
|
||||
'type' => $this->type,
|
||||
'principal' => $this->principal,
|
||||
'createdTimestamp' => $this->createdTimestamp,
|
||||
'lastUpdatedTimestamp' => $this->lastUpdatedTimestamp,
|
||||
];
|
||||
}
|
||||
|
||||
public function tableSerialize(?array $params = null): array {
|
||||
return [
|
||||
'Resource Id' => $this->resourceId,
|
||||
'Permission Level' => MemberPermissionLevel::from($this->permissionLevel)->name,
|
||||
'Type' => MemberType::from($this->type)->name,
|
||||
'Principal' => $this->principal,
|
||||
'Created' => $this->createdTimestamp,
|
||||
'LastUpdated' => $this->lastUpdatedTimestamp,
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue