From 5b344d2c96a8571a28de2418e9fbd4fb1bb07c24 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 11 Jul 2020 07:29:27 +0300 Subject: [PATCH 01/10] Added spec file --- docs/specs/realtime.drawio | 120 +++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 docs/specs/realtime.drawio diff --git a/docs/specs/realtime.drawio b/docs/specs/realtime.drawio new file mode 100644 index 0000000000..ff096ae868 --- /dev/null +++ b/docs/specs/realtime.drawio @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From eafa84646ae09bd24f2a91027e262615f41fea66 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 11 Jul 2020 09:50:32 +0300 Subject: [PATCH 02/10] Added functions spec --- docs/specs/functions.drawio | 142 ++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 docs/specs/functions.drawio diff --git a/docs/specs/functions.drawio b/docs/specs/functions.drawio new file mode 100644 index 0000000000..f92a0261f0 --- /dev/null +++ b/docs/specs/functions.drawio @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From e2325407e830ee0bd230ae6c27807769448273c4 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 11 Jul 2020 13:25:28 +0300 Subject: [PATCH 03/10] Updated specs --- docs/specs/custom-domains.drawio | 166 +++++++++++++ docs/specs/functions.drawio | 6 +- docs/specs/overview.drawio | 413 +++++++++++++++++++++++++++++++ docs/specs/realtime.drawio | 49 ++-- 4 files changed, 608 insertions(+), 26 deletions(-) create mode 100644 docs/specs/custom-domains.drawio create mode 100644 docs/specs/overview.drawio diff --git a/docs/specs/custom-domains.drawio b/docs/specs/custom-domains.drawio new file mode 100644 index 0000000000..23968590c3 --- /dev/null +++ b/docs/specs/custom-domains.drawio @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/specs/functions.drawio b/docs/specs/functions.drawio index f92a0261f0..2ce348591d 100644 --- a/docs/specs/functions.drawio +++ b/docs/specs/functions.drawio @@ -1,6 +1,6 @@ - + - + @@ -77,7 +77,7 @@ - + diff --git a/docs/specs/overview.drawio b/docs/specs/overview.drawio new file mode 100644 index 0000000000..249502bf74 --- /dev/null +++ b/docs/specs/overview.drawio @@ -0,0 +1,413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/specs/realtime.drawio b/docs/specs/realtime.drawio index ff096ae868..fc76cf187c 100644 --- a/docs/specs/realtime.drawio +++ b/docs/specs/realtime.drawio @@ -1,6 +1,6 @@ - + - + @@ -11,25 +11,25 @@ - + - + - + - + - + @@ -38,33 +38,33 @@ - + - + - + - + - + - + @@ -73,34 +73,34 @@ - + - + - + - + - + - + - + - + - + @@ -112,7 +112,10 @@ - + + + + From 40839e12f1b94de2840270c24004ff3832506447 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 11 Jul 2020 16:01:34 +0300 Subject: [PATCH 04/10] Added SVG files to all specs! --- docs/specs/custom-domains.svg | 1 + docs/specs/functions.svg | 1 + docs/specs/overview.svg | 1 + docs/specs/realtime.svg | 1 + 4 files changed, 4 insertions(+) create mode 100644 docs/specs/custom-domains.svg create mode 100644 docs/specs/functions.svg create mode 100644 docs/specs/overview.svg create mode 100644 docs/specs/realtime.svg diff --git a/docs/specs/custom-domains.svg b/docs/specs/custom-domains.svg new file mode 100644 index 0000000000..73b7520c3d --- /dev/null +++ b/docs/specs/custom-domains.svg @@ -0,0 +1 @@ +
Console
Console
Domain Verification
Domain Verification
DNS Validation
DNS Validation
SSL Generator
(100 hosts per cert)
SSL Generator...
Renewals in 60 days
Renewals in 60 days
Cert 1
Cert 1
appwrite.io
appwrite.io
DNS Server
DNS Server
CNAME Record
CNAME Record
TXT Record
TXT Record
Loadbalancer
Loadbalancer
SSL Certificates
SSL Certificates
    appwrite.demoapp.com/v1    
    appwrite.demoapp.com/v1    
demoapp.com
demoapp.com
Platforms
Platforms
Custom Domains
Custom Domains
Web
Web
Cert 2
Cert 2
Cert 3
Cert 3
Cert 4
Cert 4
Cert 5
Cert 5

Custom Domains

Specification for adding, validating and generating custom domains
and SSL certificates for the Appwrite API.

Custom Domains...
Viewer does not support full SVG 1.1
\ No newline at end of file diff --git a/docs/specs/functions.svg b/docs/specs/functions.svg new file mode 100644 index 0000000000..a5f50b743f --- /dev/null +++ b/docs/specs/functions.svg @@ -0,0 +1 @@ +
Console
Console
Code Packger
(CLI Tool?)
Code Packger...
Web IDE
(Based on PRISM?)
Web IDE...
Database
Database
Functions
Functions
PHP
PHP
Node.js
Node.js
appwrite
appwrite
    appwrite.demoapp.com/v1    
    appwrite.demoapp.com/v1    
demoapp.com
demoapp.com

Cloud Functions

Specification for adding, executing and managing custom, user supplied cloud functions.

Cloud Functions...
Python
Python
Ruby
Ruby
Versions / Tags
Versions / Tags
Encrypted Code
(Storage)
Encrypted Code...
Execution
Execution
Worker
Worker
Warmup / Pull
(All Docker Images)
Warmup / Pull...
Execute Code
(Limit Execution Time)
Execute Code...
Log Result
Log Result
Viewer does not support full SVG 1.1
\ No newline at end of file diff --git a/docs/specs/overview.svg b/docs/specs/overview.svg new file mode 100644 index 0000000000..7b376f6604 --- /dev/null +++ b/docs/specs/overview.svg @@ -0,0 +1 @@ +
Web
Web
Flutter
Flutter
iOS
iOS
Android
Android
Servers
Servers
Appwrite
Appwrite
Loadbalancer
Loadbalancer
Console
Console
APIs
APIs
Pub/Sub (Redis)
Pub/Sub (Redis)
Cache (Redis)
Cache (Redis)
Database (MariaDB)
Database (MariaDB)
Users
Users
Account
Account
Teams
Teams
Database
Database
Storage
Storage
Localization
Localization
Avatars
Avatars
Health
Health
SSL Gateway
SSL Gateway
Deletes
Deletes
Security Layer
Security Layer
Usage
Usage
Audits
Audits
Mails
Mails
SMTP
SMTP
Tasks
Tasks
Webhooks
Webhooks
Functions
Functions
Docker
Docker
StatsD (Telegraf)
StatsD (Telegraf)
TimeSeries (InfluxDB)
TimeSeries (InfluxDB)
Certs
Certs
Scheduler
Scheduler
Letsencrypt
Letsencrypt
AntiVirus (ClamAV)
AntiVirus (ClamAV)
Viewer does not support full SVG 1.1
\ No newline at end of file diff --git a/docs/specs/realtime.svg b/docs/specs/realtime.svg new file mode 100644 index 0000000000..93788ddd2a --- /dev/null +++ b/docs/specs/realtime.svg @@ -0,0 +1 @@ +
Appwrite API
Appwrite API
Send all events
Send all events
Messaging Worker
Messaging Worker
Redis - Message Log
Redis - Message Log
Expire Every x seconds
Expire Every x secon...
Websocket 1
Websocket 1
Connections
Connections
Events
Events
Authorization
Authorization
Websocket 2
Websocket 2
Websocket 3
Websocket 3
Pull
Pull
Connections
Connections
Events
Events
Authorization
Authorization
Connections
Connections
Events
Events
Authorization
Authorization
Clients
Clients
LoadBalancer
LoadBalancer

Real Time
Specification for adding, a sclabale, realtime stream to trasmit Appwrite system and user generated events to any platform.

Real Time...
Viewer does not support full SVG 1.1
\ No newline at end of file From 8d96d27ee67709ae2d9f05a1e75ff18667405040 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 11 Jul 2020 16:05:12 +0300 Subject: [PATCH 05/10] Added editable SVG files --- docs/specs/{custom-domains.svg => custom-domains.svg.drawio} | 0 docs/specs/{functions.svg => functions.svg.drawio} | 0 docs/specs/{overview.svg => overview.svg.drawio} | 0 docs/specs/{realtime.svg => realtime.svg.drawio} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename docs/specs/{custom-domains.svg => custom-domains.svg.drawio} (100%) rename docs/specs/{functions.svg => functions.svg.drawio} (100%) rename docs/specs/{overview.svg => overview.svg.drawio} (100%) rename docs/specs/{realtime.svg => realtime.svg.drawio} (100%) diff --git a/docs/specs/custom-domains.svg b/docs/specs/custom-domains.svg.drawio similarity index 100% rename from docs/specs/custom-domains.svg rename to docs/specs/custom-domains.svg.drawio diff --git a/docs/specs/functions.svg b/docs/specs/functions.svg.drawio similarity index 100% rename from docs/specs/functions.svg rename to docs/specs/functions.svg.drawio diff --git a/docs/specs/overview.svg b/docs/specs/overview.svg.drawio similarity index 100% rename from docs/specs/overview.svg rename to docs/specs/overview.svg.drawio diff --git a/docs/specs/realtime.svg b/docs/specs/realtime.svg.drawio similarity index 100% rename from docs/specs/realtime.svg rename to docs/specs/realtime.svg.drawio From 31789b6e8a890293fa7141b5d34fc1ec9e338d3a Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 11 Jul 2020 16:06:45 +0300 Subject: [PATCH 06/10] Updated file extensions --- .../{custom-domains.svg.drawio => custom-domains.drawio.svg} | 0 docs/specs/{functions.svg.drawio => functions.drawio.svg} | 0 docs/specs/{overview.svg.drawio => overview.drawio.svg} | 0 docs/specs/{realtime.svg.drawio => realtime.drawio.svg} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename docs/specs/{custom-domains.svg.drawio => custom-domains.drawio.svg} (100%) rename docs/specs/{functions.svg.drawio => functions.drawio.svg} (100%) rename docs/specs/{overview.svg.drawio => overview.drawio.svg} (100%) rename docs/specs/{realtime.svg.drawio => realtime.drawio.svg} (100%) diff --git a/docs/specs/custom-domains.svg.drawio b/docs/specs/custom-domains.drawio.svg similarity index 100% rename from docs/specs/custom-domains.svg.drawio rename to docs/specs/custom-domains.drawio.svg diff --git a/docs/specs/functions.svg.drawio b/docs/specs/functions.drawio.svg similarity index 100% rename from docs/specs/functions.svg.drawio rename to docs/specs/functions.drawio.svg diff --git a/docs/specs/overview.svg.drawio b/docs/specs/overview.drawio.svg similarity index 100% rename from docs/specs/overview.svg.drawio rename to docs/specs/overview.drawio.svg diff --git a/docs/specs/realtime.svg.drawio b/docs/specs/realtime.drawio.svg similarity index 100% rename from docs/specs/realtime.svg.drawio rename to docs/specs/realtime.drawio.svg From 489810708bbb4b8ff685d45e81c80f45599b220d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 11 Jul 2020 16:07:33 +0300 Subject: [PATCH 07/10] No need for drawio files --- docs/specs/custom-domains.drawio | 166 ------------- docs/specs/functions.drawio | 142 ----------- docs/specs/overview.drawio | 413 ------------------------------- docs/specs/realtime.drawio | 123 --------- 4 files changed, 844 deletions(-) delete mode 100644 docs/specs/custom-domains.drawio delete mode 100644 docs/specs/functions.drawio delete mode 100644 docs/specs/overview.drawio delete mode 100644 docs/specs/realtime.drawio diff --git a/docs/specs/custom-domains.drawio b/docs/specs/custom-domains.drawio deleted file mode 100644 index 23968590c3..0000000000 --- a/docs/specs/custom-domains.drawio +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/specs/functions.drawio b/docs/specs/functions.drawio deleted file mode 100644 index 2ce348591d..0000000000 --- a/docs/specs/functions.drawio +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/specs/overview.drawio b/docs/specs/overview.drawio deleted file mode 100644 index 249502bf74..0000000000 --- a/docs/specs/overview.drawio +++ /dev/null @@ -1,413 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/specs/realtime.drawio b/docs/specs/realtime.drawio deleted file mode 100644 index fc76cf187c..0000000000 --- a/docs/specs/realtime.drawio +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From abdae9b0956930716d727e501e7a0ac5584816e7 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 11 Jul 2020 19:18:04 +0300 Subject: [PATCH 08/10] Fixed permission updating bug --- app/controllers/api/database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index af0e358a64..dadf7e9576 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -613,7 +613,7 @@ $utopia->patch('/v1/database/collections/:collectionId/documents/:documentId') } if (!empty($write)) { // Overwrite permissions only when passed - $data['$permissions']['write'] = $read; + $data['$permissions']['write'] = $write; } $data = \array_merge($document->getArrayCopy(), $data); From 1bfdab9858966944f23e92f304bf03197d082b2f Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 11 Jul 2020 19:21:20 +0300 Subject: [PATCH 09/10] Updated changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 406b697921..f5ffdc97fb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -39,6 +39,7 @@ - Fixed bug denying authentication with Github OAuth provider - New OAuth adapter for Box.com - New OAuth adapter for PayPal sandbox +- Fixed a bug making read permission overwrite write permission in some cases ## Breaking Changes - **Deprecated** `first` and `last` query params for documents list route in the database API From c8a8f4650e8e73d2a1edf54531a408602f569764 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 11 Jul 2020 19:24:18 +0300 Subject: [PATCH 10/10] Updated test to make sure permission updating bug is not happening again --- tests/e2e/Services/Database/DatabaseBase.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/Services/Database/DatabaseBase.php b/tests/e2e/Services/Database/DatabaseBase.php index 7e68940104..f769184827 100644 --- a/tests/e2e/Services/Database/DatabaseBase.php +++ b/tests/e2e/Services/Database/DatabaseBase.php @@ -415,8 +415,8 @@ trait DatabaseBase 'name' => 'Thor: Ragnaroc', 'releaseYear' => 2017, ], - 'read' => ['user:'.$this->getUser()['$id']], - 'write' => ['user:'.$this->getUser()['$id']], + 'read' => ['user:'.$this->getUser()['$id'], 'testx'], + 'write' => ['user:'.$this->getUser()['$id'], 'testy'], ]); $id = $document['body']['$id']; @@ -425,6 +425,8 @@ trait DatabaseBase $this->assertEquals($document['headers']['status-code'], 201); $this->assertEquals($document['body']['name'], 'Thor: Ragnaroc'); $this->assertEquals($document['body']['releaseYear'], 2017); + $this->assertEquals($document['body']['$permissions']['read'][1], 'testx'); + $this->assertEquals($document['body']['$permissions']['write'][1], 'testy'); $document = $this->client->call(Client::METHOD_PATCH, '/database/collections/' . $collection . '/documents/' . $id, array_merge([ 'content-type' => 'application/json',