Removed Rule and Permissions models
This commit is contained in:
parent
93ba3f0498
commit
37dd778f86
|
@ -39,7 +39,6 @@ use Appwrite\Utopia\Response\Model\Platform;
|
|||
use Appwrite\Utopia\Response\Model\Project;
|
||||
use Appwrite\Utopia\Response\Model\Rule;
|
||||
use Appwrite\Utopia\Response\Model\Tag;
|
||||
use Appwrite\Utopia\Response\Model\Task;
|
||||
use Appwrite\Utopia\Response\Model\Token;
|
||||
use Appwrite\Utopia\Response\Model\Webhook;
|
||||
use Appwrite\Utopia\Response\Model\Preferences;
|
||||
|
@ -59,7 +58,6 @@ class Response extends SwooleResponse
|
|||
const MODEL_ERROR = 'error';
|
||||
const MODEL_ERROR_DEV = 'errorDev';
|
||||
const MODEL_BASE_LIST = 'baseList';
|
||||
const MODEL_PERMISSIONS = 'permissions';
|
||||
|
||||
// Database
|
||||
const MODEL_COLLECTION = 'collection';
|
||||
|
@ -68,7 +66,6 @@ class Response extends SwooleResponse
|
|||
const MODEL_ATTRIBUTE_LIST = 'attributeList';
|
||||
const MODEL_INDEX = 'index';
|
||||
const MODEL_INDEX_LIST = 'indexList';
|
||||
const MODEL_RULE = 'rule';
|
||||
const MODEL_DOCUMENT = 'document';
|
||||
const MODEL_DOCUMENT_LIST = 'documentList';
|
||||
|
||||
|
@ -125,6 +122,10 @@ class Response extends SwooleResponse
|
|||
const MODEL_DOMAIN = 'domain';
|
||||
const MODEL_DOMAIN_LIST = 'domainList';
|
||||
|
||||
// Deprecated
|
||||
const MODEL_PERMISSIONS = 'permissions';
|
||||
const MODEL_RULE = 'rule';
|
||||
|
||||
// Tests (keep last)
|
||||
const MODEL_MOCK = 'mock';
|
||||
|
||||
|
@ -176,12 +177,10 @@ class Response extends SwooleResponse
|
|||
->setModel(new BaseList('Currencies List', self::MODEL_CURRENCY_LIST, 'currencies', self::MODEL_CURRENCY))
|
||||
->setModel(new BaseList('Phones List', self::MODEL_PHONE_LIST, 'phones', self::MODEL_PHONE))
|
||||
// Entities
|
||||
->setModel(new Permissions())
|
||||
->setModel(new Collection())
|
||||
->setModel(new Attribute())
|
||||
->setModel(new Index())
|
||||
->setModel(new ModelDocument())
|
||||
->setModel(new Rule())
|
||||
->setModel(new Log())
|
||||
->setModel(new User())
|
||||
->setModel(new Preferences())
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Model;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
|
||||
class Permissions extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->addRule('read', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Read permissions.',
|
||||
'default' => [],
|
||||
'example' => 'user:5e5ea5c16897e',
|
||||
'array' => true,
|
||||
])
|
||||
->addRule('write', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Write permissions.',
|
||||
'default' => [],
|
||||
'example' => 'user:5e5ea5c16897e',
|
||||
'array' => true,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName():string
|
||||
{
|
||||
return 'Permissions';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType():string
|
||||
{
|
||||
return Response::MODEL_PERMISSIONS;
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Model;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
|
||||
class Rule extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->addRule('$id', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Rule ID.',
|
||||
'default' => '',
|
||||
'example' => '5e5ea5c16897e',
|
||||
])
|
||||
->addRule('$collection', [ // TODO remove this from public response
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Rule Collection.',
|
||||
'example' => '5e5e66c16897e',
|
||||
])
|
||||
->addRule('type', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Rule type. Possible values: ',
|
||||
'default' => '',
|
||||
'example' => 'title',
|
||||
])
|
||||
->addRule('key', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Rule key.',
|
||||
'default' => '',
|
||||
'example' => 'title',
|
||||
])
|
||||
->addRule('label', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Rule label.',
|
||||
'default' => '',
|
||||
'example' => 'Title',
|
||||
])
|
||||
->addRule('default', [ // TODO should be of mixed types
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Rule default value.',
|
||||
'default' => '',
|
||||
'example' => 'Movie Name',
|
||||
])
|
||||
->addRule('array', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Is array?',
|
||||
'default' => false,
|
||||
'example' => false,
|
||||
])
|
||||
->addRule('required', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Is required?',
|
||||
'default' => false,
|
||||
'example' => true,
|
||||
])
|
||||
->addRule('list', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'List of allowed values',
|
||||
'array' => true,
|
||||
'default' => [],
|
||||
'example' => '5e5ea5c168099',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName():string
|
||||
{
|
||||
return 'Rule';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType():string
|
||||
{
|
||||
return Response::MODEL_RULE;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue