Skip to content

Commit 0481025

Browse files
committed
Merge branch 'dev' of https://github.com/anusii/solidpod into tony/59_circular_dependency
2 parents cbc48fa + 10bb53b commit 0481025

18 files changed

+472
-183
lines changed

lib/src/solid/common_func.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,5 @@ String getParentDir(
234234
String fileUrl,
235235
) {
236236
final dataMap = parseTTLMap(fileContent);
237-
238237
return dataMap[fileUrl]['$appsTerms$inheritancePred'].first;
239238
}

lib/src/solid/grant_permission_ui.dart

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,29 @@
22
///
33
// Time-stamp: <Wednesday 2025-10-08 15:39:39 +1100 Graham Williams>
44
///
5-
/// Copyright (C) 2024, Software Innovation Institute, ANU.
5+
/// Copyright (C) 2024-2025, Software Innovation Institute, ANU.
66
///
7-
/// Licensed under the GNU General Public License, Version 3 (the "License").
7+
/// Licensed under the MIT License (the "License").
88
///
9-
/// License: https://opensource.org/license/gpl-3-0.
9+
/// License: https://choosealicense.com/licenses/mit/.
1010
//
11-
// This program is free software: you can redistribute it and/or modify it under
12-
// the terms of the GNU General Public License as published by the Free Software
13-
// Foundation, either version 3 of the License, or (at your option) any later
14-
// version.
11+
// Permission is hereby granted, free of charge, to any person obtaining a copy
12+
// of this software and associated documentation files (the "Software"), to deal
13+
// in the Software without restriction, including without limitation the rights
14+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+
// copies of the Software, and to permit persons to whom the Software is
16+
// furnished to do so, subject to the following conditions:
1517
//
16-
// This program is distributed in the hope that it will be useful, but WITHOUT
17-
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18-
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19-
// details.
18+
// The above copyright notice and this permission notice shall be included in
19+
// all copies or substantial portions of the Software.
2020
//
21-
// You should have received a copy of the GNU General Public License along with
22-
// this program. If not, see <https://opensource.org/license/gpl-3-0>.
23-
///
21+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27+
// SOFTWARE.
2428
///
2529
/// Authors: Anushka Vidanage, Jess Moore, Ashley Tang
2630

lib/src/solid/read_external_pod.dart

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ import 'package:solidpod/src/solid/utils/key_helper.dart';
4242
import 'package:solidpod/src/solid/utils/misc.dart';
4343
import 'package:solidpod/src/solid/utils/rdf.dart';
4444

45-
/// Read file content from a POD
45+
/// Read [fileUrl] from an external POD with file [mode] (default is text).
4646
///
47-
/// First check if the user is logged in and then
48-
/// read and parse the file content
47+
/// We first check if the user is logged in and then read and parse the file
48+
/// content.
49+
///
50+
/// [fileUrl] - The path to the external file to read
51+
/// [context] - The build context
52+
/// [child] - The child widget
53+
/// [mode] - The file open mode (default: text)
4954
5055
Future<dynamic> readExternalPod(
5156
String fileUrl,
@@ -69,11 +74,26 @@ Future<dynamic> readExternalPod(
6974
// Get master key from the user if required
7075
await getKeyFromUserIfRequired(context, child);
7176

77+
Key? indKey;
78+
7279
// Decrypt if reading an encrypted file
7380
if (await KeyManager.hasSharedIndividualKey(fileUrl)) {
7481
// Get the individual key for the file
75-
final indKey = await KeyManager.getSharedIndividualKey(fileUrl);
82+
indKey = await KeyManager.getSharedIndividualKey(fileUrl);
83+
} else if (hasInheritedKey(
84+
fileContent,
85+
fileUrl,
86+
)) {
87+
// Get the individual key for the file
88+
final parentDirPath = getParentDir(
89+
fileContent,
90+
fileUrl,
91+
);
92+
final parentDirUrl = getExtDirUrl(fileUrl, parentDirPath);
93+
indKey = await KeyManager.getSharedIndividualKey(parentDirUrl);
94+
}
7695

96+
if (indKey != null) {
7797
// Decrypt the file content
7898

7999
final dataMap = parseTTL(fileContent);

lib/src/solid/revoke_permission.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ Future<dynamic> revokePermission(
8787
resourceUrl = fileName;
8888
}
8989

90-
// print(resourceUrl);
91-
9290
// Check if file/directory exists
9391
final resStatus = await checkResourceStatus(resourceUrl, isFile: isFile);
9492

lib/src/solid/shared_resources_ui.dart

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,29 @@
22
///
33
// Time-stamp: <Sunday 2024-06-24 11:26:00 +1000 Anushka Vidange>
44
///
5-
/// Copyright (C) 2024, Software Innovation Institute, ANU.
5+
/// Copyright (C) 2024-2025, Software Innovation Institute, ANU.
66
///
7-
/// Licensed under the GNU General Public License, Version 3 (the "License").
7+
/// Licensed under the MIT License (the "License").
88
///
9-
/// License: https://opensource.org/license/gpl-3-0.
9+
/// License: https://choosealicense.com/licenses/mit/.
1010
//
11-
// This program is free software: you can redistribute it and/or modify it under
12-
// the terms of the GNU General Public License as published by the Free Software
13-
// Foundation, either version 3 of the License, or (at your option) any later
14-
// version.
11+
// Permission is hereby granted, free of charge, to any person obtaining a copy
12+
// of this software and associated documentation files (the "Software"), to deal
13+
// in the Software without restriction, including without limitation the rights
14+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+
// copies of the Software, and to permit persons to whom the Software is
16+
// furnished to do so, subject to the following conditions:
1517
//
16-
// This program is distributed in the hope that it will be useful, but WITHOUT
17-
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18-
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19-
// details.
18+
// The above copyright notice and this permission notice shall be included in
19+
// all copies or substantial portions of the Software.
2020
//
21-
// You should have received a copy of the GNU General Public License along with
22-
// this program. If not, see <https://opensource.org/license/gpl-3-0>.
21+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27+
// SOFTWARE.
2328
///
2429
///
2530
/// Authors: Anushka Vidanage

lib/src/solid/solid_func_call_status.dart

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,29 @@
22
///
33
// Time-stamp: <Thursday 2024-06-27 13:13:12 +1000 Graham Williams>
44
///
5-
/// Copyright (C) 2024, Software Innovation Institute, ANU.
5+
/// Copyright (C) 2024-2025, Software Innovation Institute, ANU.
66
///
7-
/// Licensed under the GNU General Public License, Version 3 (the "License").
7+
/// Licensed under the MIT License (the "License").
88
///
9-
/// License: https://opensource.org/license/gpl-3-0.
9+
/// License: https://choosealicense.com/licenses/mit/.
1010
//
11-
// This program is free software: you can redistribute it and/or modify it under
12-
// the terms of the GNU General Public License as published by the Free Software
13-
// Foundation, either version 3 of the License, or (at your option) any later
14-
// version.
11+
// Permission is hereby granted, free of charge, to any person obtaining a copy
12+
// of this software and associated documentation files (the "Software"), to deal
13+
// in the Software without restriction, including without limitation the rights
14+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+
// copies of the Software, and to permit persons to whom the Software is
16+
// furnished to do so, subject to the following conditions:
1517
//
16-
// This program is distributed in the hope that it will be useful, but WITHOUT
17-
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18-
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19-
// details.
18+
// The above copyright notice and this permission notice shall be included in
19+
// all copies or substantial portions of the Software.
2020
//
21-
// You should have received a copy of the GNU General Public License along with
22-
// this program. If not, see <https://opensource.org/license/gpl-3-0>.
21+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27+
// SOFTWARE.
2328
///
2429
///
2530
/// Authors: Anushka Vidanage

lib/src/solid/utils/is_phone.dart

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,29 @@
22
///
33
// Time-stamp: <Saturday 2025-08-02 21:01:01 +1000 Jess Moore>
44
///
5-
/// Copyright (C) 2024, Software Innovation Institute, ANU.
5+
/// Copyright (C) 2024-2025, Software Innovation Institute, ANU.
66
///
7-
/// Licensed under the GNU General Public License, Version 3 (the "License").
7+
/// Licensed under the MIT License (the "License").
88
///
9-
/// License: https://opensource.org/license/gpl-3-0.
9+
/// License: https://choosealicense.com/licenses/mit/.
1010
//
11-
// This program is free software: you can redistribute it and/or modify it under
12-
// the terms of the GNU General Public License as published by the Free Software
13-
// Foundation, either version 3 of the License, or (at your option) any later
14-
// version.
11+
// Permission is hereby granted, free of charge, to any person obtaining a copy
12+
// of this software and associated documentation files (the "Software"), to deal
13+
// in the Software without restriction, including without limitation the rights
14+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+
// copies of the Software, and to permit persons to whom the Software is
16+
// furnished to do so, subject to the following conditions:
1517
//
16-
// This program is distributed in the hope that it will be useful, but WITHOUT
17-
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18-
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19-
// details.
18+
// The above copyright notice and this permission notice shall be included in
19+
// all copies or substantial portions of the Software.
2020
//
21-
// You should have received a copy of the GNU General Public License along with
22-
// this program. If not, see <https://opensource.org/license/gpl-3-0>.
21+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27+
// SOFTWARE.
2328
///
2429
/// Authors: Jess Moore
2530

lib/src/solid/utils/misc.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,22 @@ Future<String> getDirUrl(String dirPath, [String? extWebId]) async =>
192192
? await _getResourceUrl(dirPath, true)
193193
: await _getResourceUrl(dirPath, true, extWebId);
194194

195+
/// Derive external POD inherited parent directory url from the resource url
196+
/// and parent directory path
197+
String getExtDirUrl(String resourceUrl, String dirPath) {
198+
int pathIndex = resourceUrl.indexOf(dirPath);
199+
200+
String dirUrl = '';
201+
if (pathIndex != -1) {
202+
dirUrl = resourceUrl.substring(0, pathIndex + dirPath.length);
203+
if (!dirUrl.endsWith('/')) {
204+
dirUrl += '/';
205+
}
206+
}
207+
208+
return dirUrl;
209+
}
210+
195211
/// Encrypt a given data string and format to TTL
196212
Future<String> getEncTTLStr(
197213
String filePath,

lib/src/solid/utils/snack_bar.dart

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,29 @@
22
///
33
// Time-stamp: <Sunday 2024-07-11 12:55:00 +1000 Anushka Vidange>
44
///
5-
/// Copyright (C) 2024, Software Innovation Institute, ANU.
5+
/// Copyright (C) 2024-2025, Software Innovation Institute, ANU.
66
///
7-
/// Licensed under the GNU General Public License, Version 3 (the "License").
7+
/// Licensed under the MIT License (the "License").
88
///
9-
/// License: https://opensource.org/license/gpl-3-0.
9+
/// License: https://choosealicense.com/licenses/mit/.
1010
//
11-
// This program is free software: you can redistribute it and/or modify it under
12-
// the terms of the GNU General Public License as published by the Free Software
13-
// Foundation, either version 3 of the License, or (at your option) any later
14-
// version.
11+
// Permission is hereby granted, free of charge, to any person obtaining a copy
12+
// of this software and associated documentation files (the "Software"), to deal
13+
// in the Software without restriction, including without limitation the rights
14+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+
// copies of the Software, and to permit persons to whom the Software is
16+
// furnished to do so, subject to the following conditions:
1517
//
16-
// This program is distributed in the hope that it will be useful, but WITHOUT
17-
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18-
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19-
// details.
18+
// The above copyright notice and this permission notice shall be included in
19+
// all copies or substantial portions of the Software.
2020
//
21-
// You should have received a copy of the GNU General Public License along with
22-
// this program. If not, see <https://opensource.org/license/gpl-3-0>.
21+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27+
// SOFTWARE.
2328
///
2429
///
2530
/// Authors: Dawei Chen, Anushka Vidanage

0 commit comments

Comments
 (0)