From 436838ee4a62ba4a5db705803d93f49e6525a1b0 Mon Sep 17 00:00:00 2001
From: John Voskuilen <john.voskuilen@sapito.nl>
Date: Wed, 7 Feb 2024 14:03:59 +0100
Subject: [PATCH] Issue #3419771: Remove deprecated function user_roles()

---
 src/Entity/WorkflowManager.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Entity/WorkflowManager.php b/src/Entity/WorkflowManager.php
index f3c2bef6..40cc623f 100644
--- a/src/Entity/WorkflowManager.php
+++ b/src/Entity/WorkflowManager.php
@@ -13,6 +13,7 @@ use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\field\Entity\FieldConfig;
+use Drupal\user\Entity\Role;
 
 /**
  * Manages entity type plugin definitions.
@@ -358,7 +359,9 @@ class WorkflowManager implements WorkflowManagerInterface {
    */
   public static function participateUserRoles(EntityInterface $workflow) {
     $type_id = $workflow->id();
-    foreach (user_roles() as $rid => $role) {
+
+    $roles = Role::loadMultiple();
+    foreach ($roles as $rid => $role) {
       $perms = ["create $type_id workflow_transition" => 1];
       user_role_change_permissions($rid, $perms);  // <=== Enable Roles.
     }
-- 
GitLab