File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -255,15 +255,20 @@ public function fileDownload(string $uri) {
255255 return -1 ;
256256 }
257257
258- // User has API access.
259- $ webform = \Drupal::entityTypeManager ()->getStorage ('webform ' )->load ($ matches ['webform ' ]);
260- $ allowedUsers = $ this ->getAllowedUsers ($ webform );
258+ // User has API access. Try to load the webform.
259+ $ webform = $ this ->getWebform ($ matches ['webform ' ]);
260+ if (NULL === $ webform ) {
261+ // Deny access if webform cannot be loaded.
262+ return -1 ;
263+ }
261264
265+ $ allowedUsers = $ this ->getAllowedUsers ($ webform );
262266 // If allowed users is non-empty and user is not in there deny access.
263267 if (!empty ($ allowedUsers ) && !isset ($ allowedUsers [$ user ->id ()])) {
264268 return -1 ;
265269 }
266270 }
271+
267272 return NULL ;
268273 }
269274
You can’t perform that action at this time.
0 commit comments