f7cloud_client/apps/mail/lib/Db/MailboxShare.php
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

69 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 F7cloud / F7cloud GmbH and F7cloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Mail\Db;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;
/**
* Mailbox share: grants a user or group access to a mailbox (folder) and its subfolders.
*
* @method string getOwnerUserId()
* @method void setOwnerUserId(string $ownerUserId)
* @method int getAccountId()
* @method void setAccountId(int $accountId)
* @method int getMailboxId()
* @method void setMailboxId(int $mailboxId)
* @method string getShareType()
* @method void setShareType(string $shareType)
* @method string getShareWith()
* @method void setShareWith(string $shareWith)
* @method string getPermission()
* @method void setPermission(string $permission)
* @method int getCreatedAt()
* @method void setCreatedAt(int $createdAt)
*/
class MailboxShare extends Entity implements JsonSerializable {
protected $ownerUserId;
protected $accountId;
protected $mailboxId;
protected $shareType;
protected $shareWith;
protected $permission;
protected $createdAt;
public const TYPE_USER = 'user';
public const TYPE_GROUP = 'group';
public const PERMISSION_READ = 'read';
public const PERMISSION_READ_WRITE = 'read_write';
public function __construct() {
$this->addType('accountId', 'integer');
$this->addType('mailboxId', 'integer');
$this->addType('createdAt', 'integer');
}
#[ReturnTypeWillChange]
public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'ownerUserId' => $this->getOwnerUserId(),
'accountId' => $this->getAccountId(),
'mailboxId' => $this->getMailboxId(),
'shareType' => $this->getShareType(),
'shareWith' => $this->getShareWith(),
'permission' => $this->getPermission(),
'createdAt' => $this->getCreatedAt(),
];
}
}