diff --git a/app/config/roles.php b/app/config/roles.php index 3bf9a3e57c..fa1ce5806c 100644 --- a/app/config/roles.php +++ b/app/config/roles.php @@ -59,6 +59,7 @@ return [ Auth::USER_ROLE_GUESTS => [ 'label' => 'Guests', 'scopes' => [ + 'none', 'public', 'home', 'console', @@ -74,22 +75,22 @@ return [ ], Auth::USER_ROLE_USERS => [ 'label' => 'Users', - 'scopes' => \array_merge($member, []), + 'scopes' => \array_merge($member, [ 'none' ]), ], Auth::USER_ROLE_ADMIN => [ 'label' => 'Admin', - 'scopes' => \array_merge($admins, []), + 'scopes' => \array_merge($admins, [ 'none' ]), ], Auth::USER_ROLE_DEVELOPER => [ 'label' => 'Developer', - 'scopes' => \array_merge($admins, []), + 'scopes' => \array_merge($admins, [ 'none' ]), ], Auth::USER_ROLE_OWNER => [ 'label' => 'Owner', - 'scopes' => \array_merge($member, $admins, []), + 'scopes' => \array_merge($member, $admins, [ 'none' ]), ], Auth::USER_ROLE_APPS => [ 'label' => 'Applications', - 'scopes' => ['health.read', 'graphql'], + 'scopes' => ['health.read', 'graphql', 'none'], ], ]; diff --git a/app/controllers/general.php b/app/controllers/general.php index c1af8e276f..81eaa64f36 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -136,7 +136,12 @@ function router(App $utopia, Database $dbForConsole, SwooleRequest $swooleReques $execution = \json_decode($executionResponse, true); + $contentType = 'text/plain'; foreach ($execution['responseHeaders'] as $header) { + if (\strtolower($header['name']) === 'content-type') { + $contentType = $header['value']; + } + $response->setHeader($header['name'], $header['value']); } @@ -149,7 +154,11 @@ function router(App $utopia, Database $dbForConsole, SwooleRequest $swooleReques } } - $response->setStatusCode($execution['responseStatusCode'] ?? 200)->send($body); + $response + ->setContentType($contentType) + ->setStatusCode($execution['responseStatusCode'] ?? 200) + ->send($body); + return true; } elseif ($type === 'api') { return false; @@ -161,7 +170,7 @@ function router(App $utopia, Database $dbForConsole, SwooleRequest $swooleReques } App::init() - ->groups(['api']) + ->groups(['api', 'web']) ->inject('utopia') ->inject('swooleRequest') ->inject('request') diff --git a/composer.json b/composer.json index 322f66b880..7aa7328133 100644 --- a/composer.json +++ b/composer.json @@ -1,4 +1,5 @@ { + "minimum-stability": "dev", "name": "appwrite/server-ce", "description": "End to end backend server for frontend and mobile apps.", "type": "project", @@ -51,7 +52,7 @@ "utopia-php/config": "0.2.*", "utopia-php/database": "0.38.*", "utopia-php/domains": "1.1.*", - "utopia-php/framework": "0.29.*", + "utopia-php/framework": "dev-fix-router-behaviour as 0.29.99", "utopia-php/dsn": "0.1.*", "utopia-php/image": "0.5.*", "utopia-php/locale": "0.4.*", diff --git a/composer.lock b/composer.lock index 5ea10b3d4d..63d1b53d5a 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "5d0bd8e918333aead96afb6ed6980263", + "content-hash": "05a5e7c9a6788a7bc4b4074e680a724a", "packages": [ { "name": "adhocore/jwt", @@ -1676,16 +1676,16 @@ }, { "name": "utopia-php/framework", - "version": "0.29", + "version": "dev-fix-router-behaviour", "source": { "type": "git", "url": "https://github.com/utopia-php/framework.git", - "reference": "1c8ed95fb73531b0508ad69f85dafc4c78a64414" + "reference": "ae9c22f92111fa4bbb2389873ece26738d3c4a79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/framework/zipball/1c8ed95fb73531b0508ad69f85dafc4c78a64414", - "reference": "1c8ed95fb73531b0508ad69f85dafc4c78a64414", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/ae9c22f92111fa4bbb2389873ece26738d3c4a79", + "reference": "ae9c22f92111fa4bbb2389873ece26738d3c4a79", "shasum": "" }, "require": { @@ -1715,9 +1715,9 @@ ], "support": { "issues": "https://github.com/utopia-php/framework/issues", - "source": "https://github.com/utopia-php/framework/tree/0.29" + "source": "https://github.com/utopia-php/framework/tree/fix-router-behaviour" }, - "time": "2023-07-30T07:56:23+00:00" + "time": "2023-08-06T13:18:52+00:00" }, { "name": "utopia-php/image", @@ -5355,6 +5355,12 @@ "alias": "0.11.99", "alias_normalized": "0.11.99.0" }, + { + "package": "utopia-php/framework", + "version": "dev-fix-router-behaviour", + "alias": "0.29.99", + "alias_normalized": "0.29.99.0" + }, { "package": "utopia-php/platform", "version": "dev-feat-upgrade-framework-lib", @@ -5371,6 +5377,7 @@ "minimum-stability": "dev", "stability-flags": { "appwrite/php-runtimes": 20, + "utopia-php/framework": 20, "utopia-php/platform": 20, "utopia-php/vcs": 20 },