anusii / solidpod

MIT License
1 stars 2 forks source link

SOLID POD: API for granting permissions to a file #144

Closed anushkavidanage closed 3 months ago

anushkavidanage commented 3 months ago

permission-page

grant-permission

view-permission

cdawei commented 3 months ago

When testing, please make sure the ACL file keypod/data/key-value.ttl.acl already exists. If not, create one manually for now (#174 will address this) with the following content:

@prefix : <#>.
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix p: <https://pods.solidcommunity.au/YOUR_POD/profile/card#>.

:ControlReadWrite
    a acl:Authorization;
    acl:accessTo <key-value.ttl>;
    acl:agent p:me;
    acl:mode acl:Control, acl:Read, acl:Write.
cdawei commented 3 months ago

Note that granting additional permissions to a webID which already has some permission will be addressed later.

cdawei commented 3 months ago

Thanks Anushka for the updates, the "Check Permission" button works well.

In the screenshot below, dc101 has Read permission to the key-value.ttl file of dc104, and clicking Check Permission automatically ticks Read.

Image

Now if I manually tick Write and click Grant Permission, I got this exception

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: Exception: Failed to load profile data! Try again in a while.
#0      loadPrvTTL (package:solidpod/src/solid/utils/misc.dart:93:5)
<asynchronous suspension>
#1      RecipientPubKey._setPubKey (package:solidpod/src/solid/utils/key_management.dart:701:17)
<asynchronous suspension>
#2      RecipientPubKey.encryptData (package:solidpod/src/solid/utils/key_management.dart:718:7)
<asynchronous suspension>
#3      grantPermission (package:solidpod/src/solid/grant_permission.dart:87:26)
<asynchronous suspension>
#4      SharingScreenState._build.<anonymous closure> (package:keypod/screens/sharing.dart:380:41)
<asynchronous suspension>

However, the Write permission seems successfully granted, since I can see it by restarting keypod and then click the sharing icon button.

cdawei commented 3 months ago

Inspired by a discussion with @anushkavidanage , it turns out the above exception is due to an error in the public key ACL file in my POD. In particular, my keypod/sharing/public-key.ttl.acl mistakenly specifies something like

acl:accessTo <public-key.ttl.acl>

Change it to

acl:accessTo <public-key.ttl>

resolves the exception.