@@ -2173,31 +2173,27 @@ class ApiGateway {
21732173 protected createContextToPermissionsFn (
21742174 options : ApiGatewayOptions ,
21752175 ) : ContextToPermissionsFn {
2176- let permissionsCache ;
21772176 return options . contextToPermissions
21782177 ? async ( securityContext ?: any , defaultPermissions ?: Permission [ ] ) => {
2179- if ( ! permissionsCache ) {
2180- const permissions = options . contextToPermissions &&
2178+ const permissions = options . contextToPermissions &&
21812179 await options . contextToPermissions (
21822180 securityContext ,
21832181 defaultPermissions ,
21842182 ) ;
2185- if ( ! permissions || ! Array . isArray ( permissions ) ) {
2186- throw new Error (
2187- 'A user-defined contextToPermissions function returns an inconsistent type.'
2188- ) ;
2189- } else {
2190- permissions . forEach ( ( p ) => {
2191- if ( [ 'liveliness' , 'graphql' , 'meta' , 'data' , 'jobs' ] . indexOf ( p ) === - 1 ) {
2192- throw new Error (
2193- `A user-defined contextToPermissions function returns a wrong permission: ${ p } `
2194- ) ;
2195- }
2196- } ) ;
2197- }
2198- permissionsCache = permissions ;
2183+ if ( ! permissions || ! Array . isArray ( permissions ) ) {
2184+ throw new Error (
2185+ 'A user-defined contextToPermissions function returns an inconsistent type.'
2186+ ) ;
2187+ } else {
2188+ permissions . forEach ( ( p ) => {
2189+ if ( [ 'liveliness' , 'graphql' , 'meta' , 'data' , 'jobs' ] . indexOf ( p ) === - 1 ) {
2190+ throw new Error (
2191+ `A user-defined contextToPermissions function returns a wrong permission: ${ p } `
2192+ ) ;
2193+ }
2194+ } ) ;
21992195 }
2200- return permissionsCache ;
2196+ return permissions ;
22012197 }
22022198 : this . contextToPermDefFn ;
22032199 }
0 commit comments