1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

Replaced * with role:all

This commit is contained in:
Eldad Fux 2021-06-11 21:23:16 +03:00
parent 2a07d311e8
commit 2cf16881f1
23 changed files with 94 additions and 92 deletions

View file

@ -11,7 +11,7 @@ $collections = [
'console' => [
'$id' => 'console',
'$collection' => 'projects',
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Appwrite',
'description' => 'Appwrite core engine',
'logo' => '',
@ -51,7 +51,7 @@ $collections = [
Database::SYSTEM_COLLECTION_COLLECTIONS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Collections',
'structure' => true,
'rules' => [
@ -106,7 +106,7 @@ $collections = [
Database::SYSTEM_COLLECTION_RULES => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_RULES,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Collections Rule',
'structure' => true,
'rules' => [
@ -186,7 +186,7 @@ $collections = [
Database::SYSTEM_COLLECTION_USERS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_USERS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'User',
'structure' => true,
'rules' => [
@ -307,7 +307,7 @@ $collections = [
Database::SYSTEM_COLLECTION_SESSIONS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_SESSIONS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Session',
'structure' => true,
'rules' => [
@ -505,7 +505,7 @@ $collections = [
Database::SYSTEM_COLLECTION_TOKENS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_TOKENS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Token',
'structure' => true,
'rules' => [
@ -568,7 +568,7 @@ $collections = [
Database::SYSTEM_COLLECTION_MEMBERSHIPS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_MEMBERSHIPS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Membership',
'structure' => true,
'rules' => [
@ -640,7 +640,7 @@ $collections = [
Database::SYSTEM_COLLECTION_TEAMS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_TEAMS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Team',
'structure' => true,
'rules' => [
@ -676,7 +676,7 @@ $collections = [
Database::SYSTEM_COLLECTION_PROJECTS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_PROJECTS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Project',
'structure' => true,
'rules' => [
@ -834,7 +834,7 @@ $collections = [
Database::SYSTEM_COLLECTION_WEBHOOKS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_WEBHOOKS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Webhook',
'structure' => true,
'rules' => [
@ -898,7 +898,7 @@ $collections = [
Database::SYSTEM_COLLECTION_KEYS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_KEYS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Key',
'structure' => true,
'rules' => [
@ -934,7 +934,7 @@ $collections = [
Database::SYSTEM_COLLECTION_TASKS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_TASKS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Task',
'structure' => true,
'rules' => [
@ -1088,7 +1088,7 @@ $collections = [
Database::SYSTEM_COLLECTION_PLATFORMS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_PLATFORMS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Platform',
'structure' => true,
'rules' => [
@ -1160,7 +1160,7 @@ $collections = [
Database::SYSTEM_COLLECTION_DOMAINS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_DOMAINS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Domains',
'structure' => true,
'rules' => [
@ -1223,7 +1223,7 @@ $collections = [
Database::SYSTEM_COLLECTION_CERTIFICATES => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_CERTIFICATES,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Certificates',
'structure' => true,
'rules' => [
@ -1295,7 +1295,7 @@ $collections = [
Database::SYSTEM_COLLECTION_FILES => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_FILES,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'File',
'structure' => true,
'rules' => [
@ -1439,7 +1439,7 @@ $collections = [
Database::SYSTEM_COLLECTION_FUNCTIONS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_FUNCTIONS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Functions',
'structure' => true,
'rules' => [
@ -1557,7 +1557,7 @@ $collections = [
Database::SYSTEM_COLLECTION_TAGS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_TAGS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Tags',
'structure' => true,
'rules' => [
@ -1611,7 +1611,7 @@ $collections = [
Database::SYSTEM_COLLECTION_EXECUTIONS => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_EXECUTIONS,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Executions',
'structure' => true,
'rules' => [
@ -1701,7 +1701,7 @@ $collections = [
Database::SYSTEM_COLLECTION_RESERVED => [
'$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
'$id' => Database::SYSTEM_COLLECTION_RESERVED,
'$permissions' => ['read' => ['*']],
'$permissions' => ['read' => ['role:all']],
'name' => 'Reserved',
'structure' => true,
],

View file

@ -88,7 +88,7 @@ App::post('/v1/account')
$userId = $dbForInternal->getId();
$user = $dbForInternal->createDocument('users', new Document([
'$id' => $userId,
'$read' => ['*'],
'$read' => ['role:all'],
'$write' => ['user:'.$userId],
'email' => $email,
'emailVerification' => false,
@ -464,7 +464,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
$userId = $dbForInternal->getId();
$user = $dbForInternal->createDocument('users', new Document([
'$id' => $userId,
'$read' => ['*'],
'$read' => ['role:all'],
'$write' => ['user:'.$userId],
'email' => $email,
'emailVerification' => true,
@ -621,7 +621,7 @@ App::post('/v1/account/sessions/anonymous')
$userId = $dbForInternal->getId();
$user = $dbForInternal->createDocument('users', new Document([
'$id' => $userId,
'$read' => ['*'],
'$read' => ['role:all'],
'$write' => ['user:'.$userId],
'email' => null,
'emailVerification' => false,

View file

@ -286,7 +286,7 @@ App::post('/v1/teams/:teamId/memberships')
$userId = $dbForInternal->getId();
$invitee = $dbForInternal->createDocument('users', new Document([
'$id' => $userId,
'$read' => ['user:'.$userId, '*'],
'$read' => ['user:'.$userId, 'role:all'],
'$write' => ['user:'.$userId],
'email' => $email,
'emailVerification' => false,
@ -323,7 +323,7 @@ App::post('/v1/teams/:teamId/memberships')
$membership = new Document([
'$id' => $dbForInternal->getId(),
'$read' => ['*'],
'$read' => ['role:all'],
'$write' => ['user:'.$invitee->getId(), 'team:'.$team->getId().'/owner'],
'userId' => $invitee->getId(),
'teamId' => $team->getId(),

View file

@ -46,7 +46,7 @@ App::post('/v1/users')
$userId = $dbForInternal->getId();
$user = $dbForInternal->createDocument('users', new Document([
'$id' => $userId,
'$read' => ['*'],
'$read' => ['role:all'],
'$write' => ['user:'.$userId],
'email' => $email,
'emailVerification' => false,
@ -361,8 +361,8 @@ App::patch('/v1/users/:userId/verification')
->param('userId', '', new UID(), 'User unique ID.')
->param('emailVerification', false, new Boolean(), 'User Email Verification Status.')
->inject('response')
->inject('projectDB')
->action(function ($userId, $emailVerification, $response, $projectDB) {
->inject('dbForInternal')
->action(function ($userId, $emailVerification, $response, $dbForInternal) {
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForInternal */
@ -527,7 +527,7 @@ App::delete('/v1/users/:userId')
// $dbForInternal->createDocument('users', new Document([
// '$id' => $userId,
// '$read' => ['*'],
// '$read' => ['role:all'],
// ]));
$deletes

View file

@ -131,10 +131,10 @@ $http->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swo
try {
Authorization::cleanRoles();
Authorization::setRole('*');
Authorization::setRole('role:all');
Authorization2::cleanRoles();
Authorization2::setRole('*');
Authorization2::setRole('role:all');
$app->run($request, $response);
} catch (\Throwable $th) {

View file

@ -58,7 +58,7 @@ $smtpEnabled = $this->getParam('smtpEnabled', false);
<label for="logo">Project Logo</label>
<div class="text-align-center clear">
<input type="hidden" name="logo" data-ls-bind="{{console-project.logo}}" data-read="<?php echo $this->escape(json_encode(['*'])); ?>" data-write="<?php echo $this->escape(json_encode(['team:{{console-project.teamId}}'])); ?>" data-accept="image/*" data-forms-upload="" data-label-button="Upload" data-preview-alt="Project Logo" data-scope="console" data-default="">
<input type="hidden" name="logo" data-ls-bind="{{console-project.logo}}" data-read="<?php echo $this->escape(json_encode(['role:all'])); ?>" data-write="<?php echo $this->escape(json_encode(['team:{{console-project.teamId}}'])); ?>" data-accept="image/*" data-forms-upload="" data-label-button="Upload" data-preview-alt="Project Logo" data-scope="console" data-default="">
</div>
<hr />

View file

@ -243,7 +243,7 @@ $fileLimitHuman = $this->getParam('fileLimitHuman', 0);
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">(Max file size allowed: <?php echo $fileLimitHuman; ?>)</div>
<label for="file-read">Read Access (<a data-ls-attrs="href={{env.HOME}}/docs/permissions" target="_blank" rel="noopener">Learn more</a>)</label>
<input type="hidden" id="file-read" name="read" data-forms-tags data-cast-to="json" value="<?php echo htmlentities(json_encode(['*'])); ?>" placeholder="User ID, Team ID or Role" />
<input type="hidden" id="file-read" name="read" data-forms-tags data-cast-to="json" value="<?php echo htmlentities(json_encode(['role:all'])); ?>" placeholder="User ID, Team ID or Role" />
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Add * for wildcard access</div>
<label for="file-write">Write Access (<a data-ls-attrs="href={{env.HOME}}/docs/permissions" target="_blank" rel="noopener">Learn more</a>)</label>

View file

@ -45,7 +45,7 @@
"utopia-php/cache": "0.4.*",
"utopia-php/cli": "0.11.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "0.2.*",
"utopia-php/database": "0.3.*",
"utopia-php/locale": "0.3.*",
"utopia-php/registry": "0.4.*",
"utopia-php/preloader": "0.2.*",

28
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "271f550b529e2380be5501863def0560",
"content-hash": "0456f223731164e0d43456a74949d8bf",
"packages": [
{
"name": "adhocore/jwt",
@ -1919,16 +1919,16 @@
},
{
"name": "utopia-php/database",
"version": "0.2.0",
"version": "0.3.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "b5dd144d582f3355c13f5430b1b3d7eb850bc5cd"
"reference": "6f8b7184ae4971672188607ea311a22a50da6767"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/b5dd144d582f3355c13f5430b1b3d7eb850bc5cd",
"reference": "b5dd144d582f3355c13f5430b1b3d7eb850bc5cd",
"url": "https://api.github.com/repos/utopia-php/database/zipball/6f8b7184ae4971672188607ea311a22a50da6767",
"reference": "6f8b7184ae4971672188607ea311a22a50da6767",
"shasum": ""
},
"require": {
@ -1941,7 +1941,9 @@
"utopia-php/framework": "0.*.*"
},
"require-dev": {
"fakerphp/faker": "^1.14",
"phpunit/phpunit": "^9.4",
"utopia-php/cli": "^0.11.0",
"vimeo/psalm": "4.0.1"
},
"type": "library",
@ -1974,9 +1976,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/0.2.0"
"source": "https://github.com/utopia-php/database/tree/0.3.1"
},
"time": "2021-05-26T18:41:44+00:00"
"time": "2021-06-11T15:02:46+00:00"
},
{
"name": "utopia-php/domains",
@ -4740,16 +4742,16 @@
},
{
"name": "sebastian/global-state",
"version": "5.0.2",
"version": "5.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "a90ccbddffa067b51f574dea6eb25d5680839455"
"reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455",
"reference": "a90ccbddffa067b51f574dea6eb25d5680839455",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49",
"reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49",
"shasum": ""
},
"require": {
@ -4792,7 +4794,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2"
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3"
},
"funding": [
{
@ -4800,7 +4802,7 @@
"type": "github"
}
],
"time": "2020-10-26T15:55:19+00:00"
"time": "2021-06-11T13:31:12+00:00"
},
{
"name": "sebastian/lines-of-code",

View file

@ -44,7 +44,7 @@ MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename
storage.createFile(
file: file,
read: ['*'],
read: ['role:all'],
write: []
)
.then((response) {

View file

@ -41,7 +41,7 @@ MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename
storage.createFile(
file: file,
read: ['*'],
read: ['role:all'],
write: []
)
.then((response) {

View file

@ -41,7 +41,7 @@ MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename
storage.createFile(
file: file,
read: ['*'],
read: ['role:all'],
write: []
)
.then((response) {

View file

@ -16,6 +16,7 @@ class Auth
/**
* User Roles.
*/
const USER_ROLE_ALL = 'all';
const USER_ROLE_GUEST = 'guest';
const USER_ROLE_MEMBER = 'member';
const USER_ROLE_ADMIN = 'admin';
@ -23,7 +24,6 @@ class Auth
const USER_ROLE_OWNER = 'owner';
const USER_ROLE_APP = 'app';
const USER_ROLE_SYSTEM = 'system';
const USER_ROLE_ALL = '*';
/**
* Token Types.

View file

@ -10,7 +10,7 @@ class Authorization extends Validator
/**
* @var array
*/
static $roles = ['*' => true];
static $roles = ['role:all' => true];
/**
* @var Document

View file

@ -20,7 +20,7 @@ class File extends Model
'type' => self::TYPE_STRING,
'description' => 'File read permissions.',
'default' => [],
'example' => ['*'],
'example' => ['role:all'],
'array' => true,
])
->addRule('$write', [

View file

@ -17,7 +17,7 @@ trait DatabaseBase
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'name' => 'Actors',
'read' => ['*'],
'read' => ['role:all'],
'write' => ['role:member', 'role:admin'],
'rules' => [
[
@ -53,7 +53,7 @@ trait DatabaseBase
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'name' => 'Movies',
'read' => ['*'],
'read' => ['role:all'],
'write' => ['role:member', 'role:admin'],
'rules' => [
[
@ -553,7 +553,7 @@ trait DatabaseBase
'releaseYear' => 1945,
'actors' => [],
],
'read' => ['*'],
'read' => ['role:all'],
]);
$this->assertEquals($document['headers']['status-code'], 200);
@ -563,14 +563,14 @@ trait DatabaseBase
if($this->getSide() == 'client') {
$this->assertCount(1, $document['body']['$permissions']['read']);
$this->assertCount(1, $document['body']['$permissions']['write']);
$this->assertEquals(['*'], $document['body']['$permissions']['read']);
$this->assertEquals(['role:all'], $document['body']['$permissions']['read']);
$this->assertEquals(['user:'.$this->getUser()['$id']], $document['body']['$permissions']['write']);
}
if($this->getSide() == 'server') {
$this->assertCount(1, $document['body']['$permissions']['read']);
$this->assertCount(0, $document['body']['$permissions']['write']);
$this->assertEquals(['*'], $document['body']['$permissions']['read']);
$this->assertEquals(['role:all'], $document['body']['$permissions']['read']);
$this->assertEquals([], $document['body']['$permissions']['write']);
}
@ -586,14 +586,14 @@ trait DatabaseBase
if($this->getSide() == 'client') {
$this->assertCount(1, $document['body']['$permissions']['read']);
$this->assertCount(1, $document['body']['$permissions']['write']);
$this->assertEquals(['*'], $document['body']['$permissions']['read']);
$this->assertEquals(['role:all'], $document['body']['$permissions']['read']);
$this->assertEquals(['user:'.$this->getUser()['$id']], $document['body']['$permissions']['write']);
}
if($this->getSide() == 'server') {
$this->assertCount(1, $document['body']['$permissions']['read']);
$this->assertCount(0, $document['body']['$permissions']['write']);
$this->assertEquals(['*'], $document['body']['$permissions']['read']);
$this->assertEquals(['role:all'], $document['body']['$permissions']['read']);
$this->assertEquals([], $document['body']['$permissions']['write']);
}

View file

@ -26,7 +26,7 @@ class DatabaseCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'name' => 'Actors',
'read' => ['*'],
'read' => ['role:all'],
'write' => ['role:member', 'role:admin'],
'rules' => [
[

View file

@ -139,7 +139,7 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-key' => $apikey,
], [
'name' => 'Test',
'execute' => ['*'],
'execute' => ['role:all'],
'env' => 'php-8.0',
'vars' => [
'funcKey1' => 'funcValue1',

View file

@ -18,8 +18,8 @@ trait StorageBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'),
'read' => ['*'],
'write' => ['*'],
'read' => ['role:all'],
'write' => ['role:all'],
]);
$this->assertEquals($file['headers']['status-code'], 201);
@ -185,8 +185,8 @@ trait StorageBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'read' => ['*'],
'write' => ['*'],
'read' => ['role:all'],
'write' => ['role:all'],
]);
$this->assertEquals(200, $file['headers']['status-code']);

View file

@ -18,8 +18,8 @@ trait WebhooksBase
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'name' => 'Actors',
'read' => ['*'],
'write' => ['*'],
'read' => ['role:all'],
'write' => ['role:all'],
'rules' => [
[
'label' => 'First Name',
@ -79,8 +79,8 @@ trait WebhooksBase
'lastName' => 'Evans',
],
'read' => ['*'],
'write' => ['*'],
'read' => ['role:all'],
'write' => ['role:all'],
]);
$this->assertEquals($document['headers']['status-code'], 201);
@ -122,8 +122,8 @@ trait WebhooksBase
'firstName' => 'Chris1',
'lastName' => 'Evans2',
],
'read' => ['*'],
'write' => ['*'],
'read' => ['role:all'],
'write' => ['role:all'],
]);
$this->assertEquals($document['headers']['status-code'], 200);
@ -164,8 +164,8 @@ trait WebhooksBase
'lastName' => 'Cooper',
],
'read' => ['*'],
'write' => ['*'],
'read' => ['role:all'],
'write' => ['role:all'],
]);
$this->assertEquals($document['headers']['status-code'], 201);
@ -209,8 +209,8 @@ trait WebhooksBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'),
'read' => ['*'],
'write' => ['*'],
'read' => ['role:all'],
'write' => ['role:all'],
'folderId' => 'xyz',
]);
@ -254,8 +254,8 @@ trait WebhooksBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'read' => ['*'],
'write' => ['*'],
'read' => ['role:all'],
'write' => ['role:all'],
]);
$this->assertEquals($file['headers']['status-code'], 200);

View file

@ -28,8 +28,8 @@ class WebhooksCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'name' => 'Actors1',
'read' => ['*'],
'write' => ['*'],
'read' => ['role:all'],
'write' => ['role:all'],
'rules' => [
[
'label' => 'First Name',
@ -86,8 +86,8 @@ class WebhooksCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'name' => 'Demo',
'read' => ['*'],
'write' => ['*'],
'read' => ['role:all'],
'write' => ['role:all'],
'rules' => [
[
'label' => 'First Name',
@ -307,7 +307,7 @@ class WebhooksCustomServerTest extends Scope
], $this->getHeaders()), [
'name' => 'Test',
'env' => 'php-8.0',
'execute' => ['*'],
'execute' => ['role:all'],
'timeout' => 10,
]);
@ -349,7 +349,7 @@ class WebhooksCustomServerTest extends Scope
], $this->getHeaders()), [
'name' => 'Test',
'env' => 'php-8.0',
'execute' => ['*'],
'execute' => ['role:all'],
'vars' => [
'key1' => 'value1',
]

View file

@ -25,7 +25,7 @@ class AuthorizationTest extends TestCase
'$collection' => uniqid(),
'$permissions' => [
'read' => ['user:123', 'team:123'],
'write' => ['*'],
'write' => ['role:all'],
],
]);
$this->object = new Authorization($this->document, 'read');
@ -45,7 +45,7 @@ class AuthorizationTest extends TestCase
$this->assertEquals(Authorization::isRole('user:456'), true);
$this->assertEquals(Authorization::isRole('user:457'), false);
$this->assertEquals(Authorization::isRole(''), false);
$this->assertEquals(Authorization::isRole('*'), true);
$this->assertEquals(Authorization::isRole('role:all'), true);
$this->assertEquals($this->object->isValid($this->document->getPermissions()), true);

View file

@ -432,7 +432,7 @@ class V06Test extends TestCase
{
$content = [
'$id' => '5e5ea5c16897e',
'$permissions' => ['read' => ['*'], 'write' => ['*']],
'$permissions' => ['read' => ['role:all'], 'write' => ['role:all']],
'name' => 'Pink.png',
'dateCreated' => 1592981250,
'signature' => '5d529fd02b544198ae075bd57c1762bb',
@ -444,7 +444,7 @@ class V06Test extends TestCase
$parsedResponse = $this->filter->parse($content, $model);
$this->assertEquals($parsedResponse['$id'], '5e5ea5c16897e');
$this->assertEquals($parsedResponse['$permissions'], ['read' => ['*'], 'write' => ['*']]);
$this->assertEquals($parsedResponse['$permissions'], ['read' => ['role:all'], 'write' => ['role:all']]);
$this->assertEquals($parsedResponse['name'], 'Pink.png');
$this->assertEquals($parsedResponse['dateCreated'], 1592981250);
$this->assertEquals($parsedResponse['signature'], '5d529fd02b544198ae075bd57c1762bb');
@ -467,7 +467,7 @@ class V06Test extends TestCase
{
$content = [
'$id' => '5e5ea5c16897e',
'$permissions' => ['read' => ['*'], 'write' => ['*']],
'$permissions' => ['read' => ['role:all'], 'write' => ['role:all']],
'name' => 'Movies',
'dateCreated' => 1592981250,
'dateUpdated' => '5d529fd02b544198ae075bd57c1762bb',
@ -478,7 +478,7 @@ class V06Test extends TestCase
$parsedResponse = $this->filter->parse($content, $model);
$this->assertEquals($parsedResponse['$id'], '5e5ea5c16897e');
$this->assertEquals($parsedResponse['$permissions'], ['read' => ['*'], 'write' => ['*']]);
$this->assertEquals($parsedResponse['$permissions'], ['read' => ['role:all'], 'write' => ['role:all']]);
$this->assertEquals($parsedResponse['name'], 'Movies');
$this->assertEquals($parsedResponse['dateCreated'], 1592981250);
$this->assertEquals($parsedResponse['dateUpdated'], '5d529fd02b544198ae075bd57c1762bb');
@ -495,7 +495,7 @@ class V06Test extends TestCase
'collections' => [
0 => [
'$id' => '5e5ea5c16897e',
'$permissions' => ['read' => ['*'], 'write' => ['*']],
'$permissions' => ['read' => ['role:all'], 'write' => ['role:all']],
'name' => 'Movies',
'dateCreated' => 1592981250,
'dateUpdated' => '5d529fd02b544198ae075bd57c1762bb',
@ -509,7 +509,7 @@ class V06Test extends TestCase
$this->assertEquals($parsedResponse['sum'], 1);
$this->assertEquals($parsedResponse['collections'][0]['$id'], '5e5ea5c16897e');
$this->assertEquals($parsedResponse['collections'][0]['$permissions'], ['read' => ['*'], 'write' => ['*']]);
$this->assertEquals($parsedResponse['collections'][0]['$permissions'], ['read' => ['role:all'], 'write' => ['role:all']]);
$this->assertEquals($parsedResponse['collections'][0]['name'], 'Movies');
$this->assertEquals($parsedResponse['collections'][0]['dateCreated'], 1592981250);
$this->assertEquals($parsedResponse['collections'][0]['dateUpdated'], '5d529fd02b544198ae075bd57c1762bb');