@@ -26,13 +26,13 @@ class ACLChecker {
2626
2727 // Check the permissions within the nearest ACL
2828 return this . getNearestACL ( resource )
29- . then ( ( { acl, graph, accessType } ) =>
29+ . then ( ( { acl, graph, isContainer } ) =>
3030 this . checkAccess (
3131 graph , // The ACL graph
3232 user , // The webId of the user
3333 mode , // Read/Write/Append
3434 resource , // The resource we want to access
35- accessType , // accessTo or defaultForNew
35+ isContainer ,
3636 acl , // The current Acl file!
3737 options
3838 )
@@ -52,18 +52,18 @@ class ACLChecker {
5252
5353 // Gets the ACL that applies to the resource
5454 getNearestACL ( uri ) {
55- let accessType = 'accessTo'
55+ let isContainer = false
5656 let nearestACL = Promise . reject ( )
5757 for ( const acl of this . getPossibleACLs ( uri , this . suffix ) ) {
5858 nearestACL = nearestACL . catch ( ( ) => new Promise ( ( resolve , reject ) => {
5959 this . debug ( `Check if ACL exists: ${ acl } ` )
6060 this . fetch ( acl , ( err , graph ) => {
6161 if ( err || ! graph || ! graph . length ) {
6262 if ( err ) this . debug ( `Error reading ${ acl } : ${ err } ` )
63- accessType = 'defaultForNew'
63+ isContainer = true
6464 reject ( err )
6565 } else {
66- resolve ( { acl, graph, accessType } )
66+ resolve ( { acl, graph, isContainer } )
6767 }
6868 } )
6969 } ) )
@@ -104,14 +104,13 @@ class ACLChecker {
104104 * @param user {String} WebID URI of the user accessing the resource
105105 * @param mode {String} Access mode, e.g. 'Read', 'Write', etc.
106106 * @param resource {String} URI of the resource being accessed
107- * @param accessType {String} One of `accessTo`, or `default`
107+ * @param isContainer {boolean}
108108 * @param acl {String} URI of this current .acl resource
109109 * @param options {Object} Options hashmap
110110 * @param [options.origin] Request's `Origin:` header
111111 * @param [options.host] Request's host URI (with protocol)
112112 */
113- checkAccess ( graph , user , mode , resource , accessType , acl , options = { } ) {
114- const isContainer = accessType . startsWith ( 'default' )
113+ checkAccess ( graph , user , mode , resource , isContainer , acl , options = { } ) {
115114 const acls = this . getPermissionSet ( graph , resource , isContainer , acl , options )
116115
117116 return acls . checkAccess ( resource , user , mode )
0 commit comments