ID updates

This commit is contained in:
Jake Barnby
2022-08-14 22:33:36 +12:00
parent a8698b6065
commit b007acfa95
61 changed files with 1010 additions and 928 deletions
+4 -3
View File
@@ -9,6 +9,7 @@ use Utopia\CLI\Console;
use Utopia\Config\Config;
use Exception;
use Utopia\App;
use Utopia\Database\ID;
use Utopia\Database\Validator\Authorization;
abstract class Migration
@@ -62,15 +63,15 @@ abstract class Migration
Authorization::setDefaultStatus(false);
$this->collections = array_merge([
'_metadata' => [
'$id' => '_metadata',
'$id' => ID::custom('_metadata'),
'$collection' => Database::METADATA
],
'audit' => [
'$id' => 'audit',
'$id' => ID::custom('audit'),
'$collection' => Database::METADATA
],
'abuse' => [
'$id' => 'abuse',
'$id' => ID::custom('abuse'),
'$collection' => Database::METADATA
]
], Config::getParam('collections', []));
+2 -2
View File
@@ -158,8 +158,8 @@ class V12 extends Migration
if (!$this->projectDB->findOne('buckets', [new Query('$id', Query::TYPE_EQUAL, ['default'])])) {
$this->projectDB->createDocument('buckets', new Document([
'$id' => 'default',
'$collection' => 'buckets',
'$id' => ID::custom('default'),
'$collection' => ID::custom('buckets'),
'dateCreated' => \time(),
'dateUpdated' => \time(),
'name' => 'Default',
+1 -1
View File
@@ -67,7 +67,7 @@ class V14 extends Migration
try {
$this->projectDB->createDocument('databases', new Document([
'$id' => 'default',
'$id' => ID::custom('default'),
'name' => 'Default',
'search' => 'default Default'
]));
+1 -1
View File
@@ -278,7 +278,7 @@ class V11 extends Filter
$content['rules'] = \array_map(function ($attribute) use ($content) {
return [
'$id' => $attribute['key'],
'$collection' => $content['$id'],
'$collection' => ID::custom($content['$id']),
'type' => $attribute['type'],
'key' => $attribute['key'],
'label' => $attribute['key'],
@@ -32,7 +32,7 @@ class Bucket extends Model
'type' => self::TYPE_STRING,
'description' => 'File permissions.',
'default' => [],
'example' => [Permission::read(Role::any())],
'example' => ['read("any")'],
'array' => true,
])
->addRule('fileSecurity', [
@@ -32,7 +32,7 @@ class Collection extends Model
'type' => self::TYPE_STRING,
'description' => 'Collection permissions.',
'default' => '',
'example' => Permission::read(Role::any()),
'example' => ['read("any")'],
'array' => true
])
->addRule('databaseId', [
@@ -56,9 +56,9 @@ class Document extends Any
])
->addRule('$permissions', [
'type' => self::TYPE_STRING,
'description' => 'Document write permissions.',
'description' => 'Document permissions.',
'default' => '',
'example' => Permission::read(Role::user('608f9da25e7e1')),
'example' => ['read("any")'],
'array' => true,
])
;
@@ -28,11 +28,11 @@ class Execution extends Model
'default' => 0,
'example' => 1592981250,
])
->addRule('$permissions', [
->addRule('$roles', [
'type' => self::TYPE_STRING,
'description' => 'Execution permissions.',
'description' => 'Execution roles.',
'default' => '',
'example' => 'any',
'example' => ['any'],
'array' => true,
])
->addRule('functionId', [
+1 -1
View File
@@ -38,7 +38,7 @@ class File extends Model
'type' => self::TYPE_STRING,
'description' => 'File permissions.',
'default' => [],
'example' => Permission::read(Role::any()),
'example' => ['read("any")'],
'array' => true,
])
->addRule('name', [