File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ class ACLChecker {
2626 this . aclCached = { }
2727 this . messagesCached = { }
2828 this . requests = { }
29+ this . slug = options . slug
2930 }
3031
3132 // Returns a fulfilled promise when the user can access the resource
@@ -49,7 +50,7 @@ class ACLChecker {
4950 resource = rdf . sym ( ACLChecker . getDirectory ( this . resource ) )
5051 }
5152 // If this is an ACL, Control mode must be present for any operations
52- if ( this . isAcl ( this . resource ) ) {
53+ if ( this . isAcl ( this . resource ) || this . isAcl ( decodeURIComponent ( this . slug ) ) ) {
5354 mode = 'Control'
5455 resource = rdf . sym ( this . resource . substring ( 0 , this . resource . length - this . suffix . length ) )
5556 }
@@ -167,7 +168,8 @@ class ACLChecker {
167168 } ,
168169 suffix : ldp . suffixAcl ,
169170 strictOrigin : ldp . strictOrigin ,
170- trustedOrigins
171+ trustedOrigins,
172+ slug : req . headers [ 'slug' ]
171173 } )
172174 }
173175}
Original file line number Diff line number Diff line change @@ -545,6 +545,16 @@ describe('ACL with WebID+OIDC over HTTP', function () {
545545 done ( )
546546 } )
547547 } )
548+ it ( 'user2 should not be able able to post an acl file' , function ( done ) {
549+ var options = createOptions ( '/append-acl/abc.ttl.acl' , 'user2' , 'text/turtle' )
550+ options . body = '<a> <b> <c> .\n'
551+ request . put ( options , function ( error , response , body ) {
552+ assert . equal ( error , null )
553+ assert . equal ( response . statusCode , 403 )
554+ assert . equal ( response . statusMessage , 'User Unauthorized' )
555+ done ( )
556+ } )
557+ } )
548558 it ( 'user2 should not be able to access test file' , function ( done ) {
549559 var options = createOptions ( '/append-acl/abc.ttl' , 'user2' , 'text/turtle' )
550560 request . head ( options , function ( error , response , body ) {
Original file line number Diff line number Diff line change @@ -61,7 +61,9 @@ describe('Header handler', () => {
6161 // Retrieve the response headers
6262 let response = { }
6363 before ( async ( ) => {
64+ console . log ( 'before' )
6465 const { headers } = await request . get ( resource )
66+ console . log ( 'after' )
6567 response . headers = headers
6668 } )
6769
You can’t perform that action at this time.
0 commit comments