From 5570e1d6afb39257142c422384ccae783ff6fde2 Mon Sep 17 00:00:00 2001
From: Igor Biki <ibiki@uwaterloo.ca>
Date: Wed, 19 Oct 2022 10:03:30 -0400
Subject: [PATCH] ISTWCMS-5863: Using provided user account instead of current
 user. Comment update.

---
 uw_cfg_common.module | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/uw_cfg_common.module b/uw_cfg_common.module
index ed72eb93..60585146 100644
--- a/uw_cfg_common.module
+++ b/uw_cfg_common.module
@@ -1033,11 +1033,8 @@ function uw_cfg_common_webform_access(WebformInterface $webform, string $operati
       // admin/structure/webform/manage/WEBFORM_ID/access.
       $create_user_ids = $webform->getAccessRules()['create']['users'];
 
-      // Get current logged in user id.
-      $current_user_id = \Drupal::currentUser()->id();
-
-      // If the logged user is in not a specified user, get access denied.
-      if (!in_array($current_user_id, $create_user_ids)) {
+      // If the logged in user is not a specified user, get access denied.
+      if (!in_array($account->id(), $create_user_ids)) {
         return AccessResult::forbidden();
       }
       break;
-- 
GitLab