-
Notifications
You must be signed in to change notification settings - Fork 3
Create subjectId without base url #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Here is what I get after using solid-acl-utils subjectid branch with your last commits.
Comments are the same for a folder .acl |
I don't know how to reproduce your second comment, for me the path stays relative. I've tried to parse the turtle, add a rule to the doc and parse it back 3 times like this: npm run build # Make sure that I'm working with the updated versionconst SolidAclParser = require('./dist/node/solid-acl-parser.bundle')
const { AclParser, Permissions } = SolidAclParser
const { READ, WRITE, APPEND, CONTROL } = Permissions
const fileUrl = 'https://otman.solid.community/private/'
const aclUrl = `${fileUrl}.acl`
const turtle = `
@prefix : <#>.
@prefix n0: <http://www.w3.org/ns/auth/acl#>.
@prefix priv: <./>.
@prefix c: </profile/card#>.
:ControlReadWrite
a n0:Authorization;
n0:accessTo priv:;
n0:agent c:me;
n0:default priv:;
n0:mode n0:Control, n0:Read, n0:Write.`
const parser = new AclParser({ fileUrl, aclUrl })
let doc, output
const main = async () => {
doc = await parser.turtleToAclDoc(turtle)
doc.addRule([READ, WRITE], 'https://first.web.id/#me')
output = await parser.aclDocToTurtle(doc)
doc = await parser.turtleToAclDoc(output)
doc.addRule([READ, WRITE, APPEND], 'https://second.web.id/#me')
output = await parser.aclDocToTurtle(doc)
doc = await parser.turtleToAclDoc(output)
doc.addRule([READ, WRITE], 'https://third.web.id/#me')
output = await parser.aclDocToTurtle(doc)
console.log(output)
}
main()Which outputs What other things would be necessary to get your results? |
Two reasons why it currently is not implemeted:
In the future, it will try to merge rules which have an index at the end in the AclDoc.minimizeRules method. Currently it only deletes those without an effect. |
You cannot expect point2 to be respected because Solid databrowser do not respect it. It rebuilds automatically the rules and merge them.
for the above and to check results I propose you to follow my steps :
If you don't want to risk breaking things in a real pod create a test pod at |
|
I'm still missing something you did. Here are the steps I've tried. Could you take a look and say what I should do differently?
Current turtle
Final turtle
|
I will take a look if the spec says something about it. But changing the subjectId is altering the meaning of the turtle, so I'm (currently) not on the same page with their decision. I will probably create an issue at mashlib/wac-spec asking for their thoughts on this. |
|
. I can reproduce your steps with the same results as you. The only difference is you added |
I think that subject in not used in acl check, but only predicate and object. So the rational for turtle was human display by group of people with same permissions in decreasing order. This is a way to avoid duplicates. I seem to have seen something in the code https://github.com/solid/solid-ui/blob/master/src/acl-control.js |
|
I was able to reproduce it for folders. The reason is that solid-ui doesn't always add a |
|
I will merge it despite the |
|
@Otto-AA |
|
Do you know what the turtle looked like before the hashtag got missing? It's hard to debug with only the final result (I've tried, but couldn't reproduce it). If I know what turtle was parsed, what rules you've added, and what the outcome is it is much easier to reproduce and debug. So if you made it online, can you take a look at the GET requests and send me the last one where it looks ok and what aclDoc modifications you've made? Ideally something like following, but not necessary: My attempt to reproduce it
const SolidAclParser = require('./dist/node/solid-acl-parser.bundle')
const { AclParser, Permissions, Agents } = SolidAclParser
const { READ, WRITE, APPEND, CONTROL } = Permissions
const fileUrl = 'https://ottoaa.bourgeoa.ga/private/test/'
const aclUrl = `${fileUrl}.acl`
const turtle = `
@prefix : <#>.
@prefix n0: <http://www.w3.org/ns/auth/acl#>.
@prefix test: <./>.
@prefix c: </profile/card#>.
:owner
n0:accessTo test:;
n0:agent c:me;
n0:default test:;
n0:mode n0:Control, n0:Read, n0:Write.`
const main = async () => {
const parser = new AclParser({ aclUrl, fileUrl })
const doc = await parser.turtleToAclDoc(turtle)
const agents = new Agents()
agents.addWebId('https://example.solid.community/profile/card#me')
agents.addPublic()
doc.addRule([READ, WRITE], agents)
doc.addRule([READ, WRITE], 'https://alain.bourgeoa.ga/profile/card#me')
console.log(await parser.aclDocToTurtle(doc))
}
main()Outputs |
Previously the subjectId in AclDoc was created using
this.accessTo + '#solid-acl-parser-rule-', now it uses'#DefaultRead-'. This makes it automatically relative to the file in which it is stored and more readable.The check that no similar rule exists was enhanced (If
pod.example.org/foo.acl#solid-acl-parser-rule-0exists it won't create#solid-acl-parser-rule-0as this could resolve to the same subjectId. Instead it will use#solid-acl-parser-rule-1)If possible it will use relative paths instead of absolute urls for accessTo, webIds, groups and defaults.
Fixes #2
Fixes #4
Fixes #5