@@ -34,17 +34,18 @@ class ACLChecker {
3434 }
3535
3636 // Check the resource's permissions
37- return this . _permissionSet . then ( acls => this . checkAccess ( acls , user , mode ) )
38- . catch ( err => {
39- debug ( `Error: ${ err . message } ` )
40- if ( ! user ) {
41- debug ( 'Authentication required' )
42- throw new HTTPError ( 401 , `Access to ${ this . resource } requires authorization` )
43- } else {
44- debug ( `${ mode } access denied for ${ user } ` )
45- throw new HTTPError ( 403 , `Access to ${ this . resource } denied for ${ user } ` )
46- }
47- } )
37+ return this . _permissionSet
38+ . then ( acls => this . checkAccess ( acls , user , mode ) )
39+ . catch ( err => {
40+ debug ( `Error: ${ err . message } ` )
41+ if ( ! user ) {
42+ debug ( 'Authentication required' )
43+ throw new HTTPError ( 401 , `Access to ${ this . resource } requires authorization` )
44+ } else {
45+ debug ( `${ mode } access denied for ${ user } ` )
46+ throw new HTTPError ( 403 , `Access to ${ this . resource } denied for ${ user } ` )
47+ }
48+ } )
4849 }
4950
5051 // Gets the ACL that applies to the resource
@@ -91,20 +92,20 @@ class ACLChecker {
9192 // Tests whether the permissions allow a given operation
9293 checkAccess ( permissionSet , user , mode ) {
9394 return permissionSet . checkAccess ( this . resource , user , mode )
94- . then ( hasAccess => {
95- if ( hasAccess ) {
96- debug ( `${ mode } access permitted to ${ user } ` )
97- return true
98- } else {
99- debug ( `${ mode } access NOT permitted to ${ user } ` )
100- throw new Error ( 'ACL file found but no matching policy found' )
101- }
102- } )
103- . catch ( err => {
104- debug ( `${ mode } access denied to ${ user } ` )
105- debug ( err )
106- throw err
107- } )
95+ . then ( hasAccess => {
96+ if ( hasAccess ) {
97+ debug ( `${ mode } access permitted to ${ user } ` )
98+ return true
99+ } else {
100+ debug ( `${ mode } access NOT permitted to ${ user } ` )
101+ throw new Error ( 'ACL file found but no matching policy found' )
102+ }
103+ } )
104+ . catch ( err => {
105+ debug ( `${ mode } access denied to ${ user } ` )
106+ debug ( err )
107+ throw err
108+ } )
108109 }
109110
110111 // Gets the permission set for the given ACL
0 commit comments