From 910f69de9eda97cc7540c5d23260e80f788107c4 Mon Sep 17 00:00:00 2001 From: ebremner <ebremner@uwaterloo.ca> Date: Fri, 10 Jul 2020 10:59:50 -0400 Subject: [PATCH] ISTWCMS-3921: updating content access form to save roles after revoking/granting permissions --- src/Form/UwContentAccessForm.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Form/UwContentAccessForm.php b/src/Form/UwContentAccessForm.php index 4eace56c..3ef33d2d 100644 --- a/src/Form/UwContentAccessForm.php +++ b/src/Form/UwContentAccessForm.php @@ -90,7 +90,7 @@ class UwContentAccessForm extends FormBase { } } - // Increment the row counter. + // Increment the row count. $row_count++; // Set the functionality column. @@ -116,10 +116,11 @@ class UwContentAccessForm extends FormBase { } } + // The submit button. $form['actions']['#type'] = 'actions'; $form['actions']['submit'] = array( '#type' => 'submit', - '#value' => $this->t('Submit'), + '#value' => $this->t('Save permissions'), '#button_type' => 'primary', ); @@ -186,6 +187,14 @@ class UwContentAccessForm extends FormBase { } } } + + // Step through each of the roles and save the role object, + // so that the permissions get saved. + foreach ($uw_role_objects as $uw_role_object) { + + // Save the role object. + $uw_role_object->save(); + } } /** -- GitLab