diff --git a/src/controllers/SubmissionsController.php b/src/controllers/SubmissionsController.php index cb1cdb1..7e958c5 100644 --- a/src/controllers/SubmissionsController.php +++ b/src/controllers/SubmissionsController.php @@ -24,6 +24,9 @@ public function actionEdit(?Submission $submission, ?int $submissionId = null): { $this->requireCpRequest(); + $settings = Workflow::$plugin->getSettings(); + $currentUser = Craft::$app->getUser()->getIdentity(); + if ($submission === null) { $submission = Submission::find()->id($submissionId)->siteId('*')->one(); @@ -32,9 +35,18 @@ public function actionEdit(?Submission $submission, ?int $submissionId = null): } } + $canEdit = true; + $editorGroup = $settings->getEditorUserGroup($submission->site); + + if ($editorGroup && $currentUser && $currentUser->isInGroup($editorGroup)) { + $canEdit = false; + } + $variables = [ 'submission' => $submission, 'title' => $submission->title, + 'settings' => $settings, + 'canEdit' => $canEdit, ]; $variables['changesCount'] = Workflow::$plugin->getContent()->getContentChangesTotalCount($submission); diff --git a/src/templates/submissions/_edit.html b/src/templates/submissions/_edit.html index fe7cc24..d6fb79d 100644 --- a/src/templates/submissions/_edit.html +++ b/src/templates/submissions/_edit.html @@ -9,7 +9,7 @@ ] %} {% set isNew = submission.id ? false : true %} -{% set fullPageForm = true %} +{% set fullPageForm = canEdit %} {% set saveShortcutRedirect = '{cpEditUrl}' %} {% set numberReviews = 0 %} @@ -28,30 +28,32 @@ {% block actionButton %} -