Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Visit the package at [pub.dev](https://pub.dev/packages/solidpod).

## 0.10 Further UI migrations

+ Fixed sharing to public/auth users bug [0.9.9 20260115 jesscmoore]
+ Support custom folder structure [0.9.8 20260114 anushkavid]
+ Restore individual recipient suggestions [0.9.7 20260113 jesscmoore]
+ Allow sharing externally owned files [0.9.6 20260110 jesscmoore]
Expand Down
2 changes: 1 addition & 1 deletion lib/src/solid/api/grant_permission_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ Future<void> copySharedKeyUserClass(
}

// Check if individual key file exists. If not create a file
if (await checkResourceStatus(userClassIndKeyFileUrl, isFile: false) ==
if (await checkResourceStatus(userClassIndKeyFileUrl, isFile: true) ==
ResourceStatus.notExist) {
// If file does not exist create a ttl file
final userClassIndKeyFileContent = await genUserClassIndKeyTTLStr([
Expand Down
2 changes: 1 addition & 1 deletion lib/src/solid/api/revoke_permission_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Future<void> removeSharedKeyUserClass(
}

// Check if individual key file exists. If not create a file
if (await checkResourceStatus(userClassIndKeyFileUrl, isFile: false) ==
if (await checkResourceStatus(userClassIndKeyFileUrl, isFile: true) ==
ResourceStatus.exist) {
// Update the existing file using a sparql query
final prefix = '${solidTermsNS.prefix}: <$appsTerms>';
Expand Down
46 changes: 25 additions & 21 deletions lib/src/solid/grant_permission.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,23 @@ Future<SolidFunctionCallStatus> grantPermission({
final resStatus = await checkResourceStatus(resourceUrl, isFile: isFile);

// Check if recipient/s have initialised their pods with the correct
// directory structure
var allRecipientsInitialised = true;
for (final recipientWebId in recipientWebIdList) {
final isInitialised =
await checkPodInitialised(recipientWebId as String);
if (!isInitialised) {
allRecipientsInitialised = false;
// directory structure - required to access the shared resource
bool allRecipientsInitialised = true;
bool hasSpecificRecipients = false;
if (specificRecipientTypeList.contains(recipientType)) {
hasSpecificRecipients = true;
for (final recipientWebId in recipientWebIdList) {
final isInitialised =
await checkPodInitialised(recipientWebId as String);
if (!isInitialised) {
allRecipientsInitialised = false;
}
}
}

if (allRecipientsInitialised) {
// Where recipient is specific recipient, only assign access
// if recipient pods have been initialised
if (allRecipientsInitialised || !hasSpecificRecipients) {
if (resStatus == ResourceStatus.exist) {
// Add the permission line to the relevant ACL file
await setPermissionAcl(
Expand All @@ -146,7 +152,7 @@ Future<SolidFunctionCallStatus> grantPermission({
: await KeyManager.getIndividualKey(resourceUrl);

// If permission granted to specific recipients
if (specificRecipientTypeList.contains(recipientType)) {
if (hasSpecificRecipients) {
// For each recipient share the individual encryption key

for (final recipientWebId in recipientWebIdList) {
Expand Down Expand Up @@ -192,13 +198,8 @@ Future<SolidFunctionCallStatus> grantPermission({
}
}

// 20260112 jesscmoore: the permission logs are not updated if
// permission granted is to give public access or give access
//to all authenticated users.

// Add log entry to owner, granter, and receiver permission log
// files for the individual recipient or each recipient in the
// recipient group.
// 20260112 jesscmoore: the permission logs should be updated
// for granting access to public, auth users, and specific recipients.

for (final recipientWebId in recipientWebIdList) {
final LogEntry logEntryRes = createPermLogEntry(
Expand All @@ -221,23 +222,26 @@ Future<SolidFunctionCallStatus> grantPermission({
final granterLogFileUrl =
await getFileUrl(logFilePath, webId: granterWebId);

// Run log entry insert query for the granter
// Add log entry to owner, granter, and receiver permission
// log files for the individual recipient or each recipient
// in the recipient group.

// Update granter log
await addPermLogLine(
logFileUrl: granterLogFileUrl,
logEntry: logEntryRes,
);

// If owner and the granter is not the same add another log file entry
// for the owner
// Upddate owner log (if owner != granter)
if (ownerLogFileUrl != granterLogFileUrl) {
await addPermLogLine(
logFileUrl: ownerLogFileUrl,
logEntry: logEntryRes,
);
}

// Add log entry if the recipient is either an individual or group of WebIDs
if (specificRecipientTypeList.contains(recipientType)) {
// Update recipient logs if the recipient is either an individual or group of WebIDs
if (hasSpecificRecipients) {
final receiverLogFileUrl =
await getFileUrl(logFilePath, webId: recipientWebId);

Expand Down