2016-10-02 07:56:36 +08:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: wolfi
|
|
|
|
* Date: 1/10/16
|
|
|
|
* Time: 23:15
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCA\Passman\Db;
|
|
|
|
|
|
|
|
|
2016-10-02 19:48:23 +08:00
|
|
|
use OCA\Passman\Utility\PermissionEntity;
|
2016-10-02 07:56:36 +08:00
|
|
|
use OCP\AppFramework\Db\Entity;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @method void setId(integer $value)
|
|
|
|
* @method integer getId()
|
|
|
|
* @method void setItemId(integer $value)
|
|
|
|
* @method integer getItemId()
|
|
|
|
* @method void setItemGuid(string $value)
|
|
|
|
* @method string getItemGuid()
|
2016-10-02 19:48:23 +08:00
|
|
|
* @method void setTargetUserId(string $value)
|
|
|
|
* @method string getTargetUserId()
|
2016-10-02 07:56:36 +08:00
|
|
|
* @method void setTargetVaultId(integer $value)
|
|
|
|
* @method integer getTargetVaultId()
|
|
|
|
* @method void setTargetVaultGuid(integer $value)
|
|
|
|
* @method string getTargetVaultGuid()
|
|
|
|
* @method void setSharedKey(string $value)
|
|
|
|
* @method string getSharedKey()
|
|
|
|
* @method void setPermissions(integer $value)
|
|
|
|
* @method integer getPermissions()
|
|
|
|
* @method void setCreated(integer $value)
|
|
|
|
* @method integer getCreated()
|
2016-10-02 22:10:04 +08:00
|
|
|
* @method void setFromUserId(integer $value)
|
|
|
|
* @method integer getFromUserId()
|
2016-10-02 07:56:36 +08:00
|
|
|
*/
|
|
|
|
|
2016-10-02 19:48:23 +08:00
|
|
|
class ShareRequest extends PermissionEntity implements \JsonSerializable {
|
2016-10-02 07:56:36 +08:00
|
|
|
|
|
|
|
protected
|
|
|
|
$itemId,
|
|
|
|
$itemGuid,
|
2016-10-02 19:48:23 +08:00
|
|
|
$targetUserId,
|
2016-10-02 07:56:36 +08:00
|
|
|
$targetVaultId,
|
|
|
|
$targetVaultGuid,
|
|
|
|
$sharedKey,
|
|
|
|
$permissions,
|
2016-10-02 22:10:04 +08:00
|
|
|
$created,
|
|
|
|
$fromUserId;
|
2016-10-02 07:56:36 +08:00
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
// add types in constructor
|
|
|
|
$this->addType('itemId', 'integer');
|
|
|
|
$this->addType('vaultId', 'integer');
|
|
|
|
$this->addType('permissions', 'integer');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Specify data which should be serialized to JSON
|
|
|
|
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
|
|
|
|
* @return mixed data which can be serialized by <b>json_encode</b>,
|
|
|
|
* which is a value of any type other than a resource.
|
|
|
|
* @since 5.4.0
|
|
|
|
*/
|
|
|
|
function jsonSerialize()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'req_id' => $this->getId(),
|
|
|
|
'item_id' => $this->getItemId(),
|
|
|
|
'item_guid' => $this->getItemGuid(),
|
2016-10-02 19:48:23 +08:00
|
|
|
'target_user_id' => $this->getTargetUserId(),
|
|
|
|
'target_vault_id' => $this->getTargetVaultId(),
|
|
|
|
'target_vault_guid' => $this->getTargetVaultGuid(),
|
2016-10-02 22:10:04 +08:00
|
|
|
'from_user_id' => $this->getFromUserId(),
|
2016-10-02 07:56:36 +08:00
|
|
|
'shared_key' => $this->getSharedKey(),
|
|
|
|
'permissions' => $this->getPermissions(),
|
|
|
|
'created' => $this->getCreated(),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|