Skip to content

Commit da418ce

Browse files
committed
Merge branch 'feature/tilde-usernames' into prep-release-0.10
2 parents 84f7ff2 + 5338277 commit da418ce

File tree

10 files changed

+147
-75
lines changed

10 files changed

+147
-75
lines changed

env-vars-server.list

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SERVER_ROOT=https://server
2-
STORAGE_ROOT=https://server/apps/solid/@alice/storage/
3-
ALICE_WEBID=https://server/apps/solid/@alice/profile/card#me
2+
STORAGE_ROOT=https://server/apps/solid/~alice/storage/
3+
ALICE_WEBID=https://server/apps/solid/~alice/profile/card#me
44
COOKIE_TYPE=nextcloud-compatible
55
USERNAME=alice
66
PASSWORD=alice123

env-vars-testers.list

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
WEBID_ALICE=https://server/apps/solid/@alice/profile/card#me
1+
WEBID_ALICE=https://server/apps/solid/~alice/profile/card#me
22
OIDC_ISSUER_ALICE=https://server
3-
STORAGE_ROOT_ALICE=https://server/apps/solid/@alice/storage/
4-
WEBID_BOB=https://thirdparty/apps/solid/@alice/profile/card#me
3+
STORAGE_ROOT_ALICE=https://server/apps/solid/~alice/storage/
4+
WEBID_BOB=https://thirdparty/apps/solid/~alice/profile/card#me
55
OIDC_ISSUER_BOB=https://thirdparty
66
STORAGE_ROOT_BOB=https://thirdparty/
7-
ALICE_WEBID=https://server/apps/solid/@alice/profile/card#me
7+
ALICE_WEBID=https://server/apps/solid/~alice/profile/card#me
88
SERVER_ROOT_ESCAPED=https:\/\/server
99
SERVER_ROOT=https://server
10-
STORAGE_ROOT=https://server/apps/solid/@alice/storage/
10+
STORAGE_ROOT=https://server/apps/solid/~alice/storage/
1111
SKIP_CONC=1

env-vars-thirdparty.list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SERVER_ROOT=https://thirdparty
2-
ALICE_WEBID=https://thirdparty/apps/solid/@alice/profile/card#me
2+
ALICE_WEBID=https://thirdparty/apps/solid/~alice/profile/card#me
33
COOKIE_TYPE=nextcloud-compatible
44
USERNAME=alice
55
PASSWORD=alice123

env.list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
ALICE_WEBID=https://server/apps/solid/@alice/profile/card#me
1+
ALICE_WEBID=https://server/apps/solid/~alice/profile/card#me
22
COOKIE_TYPE=nextcloud-compatible

solid/appinfo/routes.php

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* it's instantiated in there
1616
*/
1717

18-
1918
$routes = [
2019
['name' => 'page#approval', 'url' => '/sharing/{clientId}', 'verb' => 'GET'],
2120
['name' => 'page#handleRevoke', 'url' => '/revoke/{clientId}', 'verb' => 'DELETE'],
@@ -44,47 +43,47 @@
4443
];
4544

4645
$userIdRoutes = [
47-
['name' => 'page#profile', 'url' => '/@{userId}/', 'verb' => 'GET'],
48-
49-
['name' => 'profile#handleGet', 'url' => '/@{userId}/profile{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], ],
50-
['name' => 'profile#handlePut', 'url' => '/@{userId}/profile{path}', 'verb' => 'PUT', 'requirements' => ['path' => '.+'], ],
51-
['name' => 'profile#handlePatch', 'url' => '/@{userId}/profile{path}', 'verb' => 'PATCH', 'requirements' => ['path' => '.+'], ],
52-
['name' => 'profile#handleHead', 'url' => '/@{userId}/profile{path}', 'verb' => 'HEAD', 'requirements' => ['path' => '.+'], ],
53-
54-
['name' => 'storage#handleGet', 'url' => '/@{userId}/storage{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], ],
55-
['name' => 'storage#handlePost', 'url' => '/@{userId}/storage{path}', 'verb' => 'POST', 'requirements' => ['path' => '.+'], ],
56-
['name' => 'storage#handlePut', 'url' => '/@{userId}/storage{path}', 'verb' => 'PUT', 'requirements' => ['path' => '.+'], ],
57-
['name' => 'storage#handleDelete', 'url' => '/@{userId}/storage{path}', 'verb' => 'DELETE', 'requirements' => ['path' => '.+'], ],
58-
['name' => 'storage#handlePatch', 'url' => '/@{userId}/storage{path}', 'verb' => 'PATCH', 'requirements' => ['path' => '.+'], ],
59-
['name' => 'storage#handleHead', 'url' => '/@{userId}/storage{path}', 'verb' => 'HEAD', 'requirements' => ['path' => '.+'], ],
60-
61-
['name' => 'calendar#handleGet', 'url' => '/@{userId}/calendar{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], ],
62-
['name' => 'calendar#handlePost', 'url' => '/@{userId}/calendar{path}', 'verb' => 'POST', 'requirements' => ['path' => '.+'], ],
63-
['name' => 'calendar#handlePut', 'url' => '/@{userId}/calendar{path}', 'verb' => 'PUT', 'requirements' => ['path' => '.+'], ],
64-
['name' => 'calendar#handleDelete', 'url' => '/@{userId}/calendar{path}', 'verb' => 'DELETE', 'requirements' => ['path' => '.+'], ],
65-
['name' => 'calendar#handlePatch', 'url' => '/@{userId}/calendar{path}', 'verb' => 'PATCH', 'requirements' => ['path' => '.+'], ],
66-
['name' => 'calendar#handleHead', 'url' => '/@{userId}/calendar{path}', 'verb' => 'HEAD', 'requirements' => ['path' => '.+'], ],
67-
68-
['name' => 'contacts#handleGet', 'url' => '/@{userId}/contacts{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], ],
69-
['name' => 'contacts#handlePost', 'url' => '/@{userId}/contacts{path}', 'verb' => 'POST', 'requirements' => ['path' => '.+'], ],
70-
['name' => 'contacts#handlePut', 'url' => '/@{userId}/contacts{path}', 'verb' => 'PUT', 'requirements' => ['path' => '.+'], ],
71-
['name' => 'contacts#handleDelete', 'url' => '/@{userId}/contacts{path}', 'verb' => 'DELETE', 'requirements' => ['path' => '.+'], ],
72-
['name' => 'contacts#handlePatch', 'url' => '/@{userId}/contacts{path}', 'verb' => 'PATCH', 'requirements' => ['path' => '.+'], ],
73-
['name' => 'contacts#handleHead', 'url' => '/@{userId}/contacts{path}', 'verb' => 'HEAD', 'requirements' => ['path' => '.+'], ],
46+
['name' => 'page#profile', 'url' => '/~{userId}/', 'verb' => 'GET'],
47+
48+
['name' => 'profile#handleGet', 'url' => '/~{userId}/profile{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], ],
49+
['name' => 'profile#handlePut', 'url' => '/~{userId}/profile{path}', 'verb' => 'PUT', 'requirements' => ['path' => '.+'], ],
50+
['name' => 'profile#handlePatch', 'url' => '/~{userId}/profile{path}', 'verb' => 'PATCH', 'requirements' => ['path' => '.+'], ],
51+
['name' => 'profile#handleHead', 'url' => '/~{userId}/profile{path}', 'verb' => 'HEAD', 'requirements' => ['path' => '.+'], ],
52+
53+
['name' => 'storage#handleGet', 'url' => '/~{userId}/storage{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], ],
54+
['name' => 'storage#handlePost', 'url' => '/~{userId}/storage{path}', 'verb' => 'POST', 'requirements' => ['path' => '.+'], ],
55+
['name' => 'storage#handlePut', 'url' => '/~{userId}/storage{path}', 'verb' => 'PUT', 'requirements' => ['path' => '.+'], ],
56+
['name' => 'storage#handleDelete', 'url' => '/~{userId}/storage{path}', 'verb' => 'DELETE', 'requirements' => ['path' => '.+'], ],
57+
['name' => 'storage#handlePatch', 'url' => '/~{userId}/storage{path}', 'verb' => 'PATCH', 'requirements' => ['path' => '.+'], ],
58+
['name' => 'storage#handleHead', 'url' => '/~{userId}/storage{path}', 'verb' => 'HEAD', 'requirements' => ['path' => '.+'], ],
59+
60+
['name' => 'calendar#handleGet', 'url' => '/~{userId}/calendar{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], ],
61+
['name' => 'calendar#handlePost', 'url' => '/~{userId}/calendar{path}', 'verb' => 'POST', 'requirements' => ['path' => '.+'], ],
62+
['name' => 'calendar#handlePut', 'url' => '/~{userId}/calendar{path}', 'verb' => 'PUT', 'requirements' => ['path' => '.+'], ],
63+
['name' => 'calendar#handleDelete', 'url' => '/~{userId}/calendar{path}', 'verb' => 'DELETE', 'requirements' => ['path' => '.+'], ],
64+
['name' => 'calendar#handlePatch', 'url' => '/~{userId}/calendar{path}', 'verb' => 'PATCH', 'requirements' => ['path' => '.+'], ],
65+
['name' => 'calendar#handleHead', 'url' => '/~{userId}/calendar{path}', 'verb' => 'HEAD', 'requirements' => ['path' => '.+'], ],
66+
67+
['name' => 'contacts#handleGet', 'url' => '/~{userId}/contacts{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], ],
68+
['name' => 'contacts#handlePost', 'url' => '/~{userId}/contacts{path}', 'verb' => 'POST', 'requirements' => ['path' => '.+'], ],
69+
['name' => 'contacts#handlePut', 'url' => '/~{userId}/contacts{path}', 'verb' => 'PUT', 'requirements' => ['path' => '.+'], ],
70+
['name' => 'contacts#handleDelete', 'url' => '/~{userId}/contacts{path}', 'verb' => 'DELETE', 'requirements' => ['path' => '.+'], ],
71+
['name' => 'contacts#handlePatch', 'url' => '/~{userId}/contacts{path}', 'verb' => 'PATCH', 'requirements' => ['path' => '.+'], ],
72+
['name' => 'contacts#handleHead', 'url' => '/~{userId}/contacts{path}', 'verb' => 'HEAD', 'requirements' => ['path' => '.+'], ],
7473
];
7574

7675
// @TODO: All routes NOT generated by the UrlGenerator ANYWHERE in the code need to be checked!
7776

7877
if (Application::$userSubDomainsEnabled) {
7978
$userIdRoutes = array_map(function ($route) {
8079
if ($route['name'] === 'page#profile') {
81-
// The profile route should be `/me` instead of `/@{userId}/`
80+
// The profile route should be `/me` instead of `/~{userId}/`
8281
$route['url'] = '/me';
8382
} else {
8483
// When UserSubDomains are enabled, all routes that start with
85-
// `/@{userId}/` should just be `/`, as the userId is present
84+
// `/~{userId}/` should just be `/`, as the userId is present
8685
// in the subdomain.
87-
$route['url'] = preg_replace('#^/@{userId}/#', '/', $route['url']);
86+
$route['url'] = preg_replace('#^/~{userId}/#', '/', $route['url']);
8887
}
8988

9089
// The required userId is set to the userId from the subdomain

solid/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"laminas/laminas-diactoros": "^2.8",
3131
"lcobucci/jwt": "^4.1",
3232
"pdsinterop/flysystem-nextcloud": "^0.2",
33-
"pdsinterop/flysystem-rdf": "^0.5",
34-
"pdsinterop/solid-auth": "v0.11.0",
35-
"pdsinterop/solid-crud": "^0.7.3",
33+
"pdsinterop/flysystem-rdf": "^0.6",
34+
"pdsinterop/solid-auth": "^0.12.1",
35+
"pdsinterop/solid-crud": "^0.8",
3636
"psr/log": "^1.1"
3737
},
3838
"require-dev": {

solid/composer.lock

Lines changed: 99 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

solid/lib/Controller/ProfileController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ public function handlePut() { // $userId, $path) {
213213
// /index.php/apps/solid/profile{path}
214214
// and otherwise:
215215
// index.php/apps/solid/~{userId}/profile{path}
216-
217216
// In the first case, we'll get the username from the SERVER_NAME. In the latter, it will come from the URL;
218217
if ($this->config->getUserSubDomainsEnabled()) {
219218
$pathInfo = explode("profile/", $_SERVER['REQUEST_URI']);

solid/lib/Controller/SolidWebhookController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ private function initializeStorage($userId) {
150150
}
151151

152152
private function parseTopic($topic) {
153-
// topic = https://nextcloud.server/solid/@alice/storage/foo/bar
153+
// topic = https://nextcloud.server/solid/~alice/storage/foo/bar
154154
$appBaseUrl = $this->getAppBaseUrl(); // https://nextcloud.server/solid/
155-
$internalUrl = str_replace($appBaseUrl, '', $topic); // @alice/storage/foo/bar
155+
$internalUrl = str_replace($appBaseUrl, '', $topic); // ~alice/storage/foo/bar
156156
$pathicles = explode("/", $internalUrl);
157-
$userId = $pathicles[0]; // @alice
158-
$userId = preg_replace("/^@/", "", $userId); // alice
159-
$storageUrl = $this->getStorageUrl($userId); // https://nextcloud.server/solid/@alice/storage/
157+
$userId = $pathicles[0]; // ~alice
158+
$userId = preg_replace("/^~/", "", $userId); // alice
159+
$storageUrl = $this->getStorageUrl($userId); // https://nextcloud.server/solid/~alice/storage/
160160
$storagePath = str_replace($storageUrl, '/', $topic); // /foo/bar
161161
return array(
162162
"userId" => $userId,
@@ -182,7 +182,7 @@ private function createGetRequest($topic) {
182182
}
183183

184184
private function checkReadAccess($topic) {
185-
// split out $topic into $userId and $path https://nextcloud.server/solid/@alice/storage/foo/bar
185+
// split out $topic into $userId and $path https://nextcloud.server/solid/~alice/storage/foo/bar
186186
// - userId in this case is the pod owner (not the one doing the request). (alice)
187187
// - path is the path within the storage pod (/foo/bar)
188188
$target = $this->parseTopic($topic);

0 commit comments

Comments
 (0)