Skip to content

Commit

Permalink
fix: fixed error when editing categories with basic permissions, closes
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Jun 30, 2024
1 parent 2af247a commit 52cd023
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions phpmyfaq/admin/category.edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@
$header = Translation::get('ad_categ_edit_1') . ' "' . Strings::htmlentities($categoryData->getName()) . '" ' .
Translation::get('ad_categ_edit_2');

$allGroupsOptions = '';
$restrictedGroupsOptions = '';
if ($faqConfig->get('security.permLevel') !== 'basic') {
$allGroupsOptions = $currentUser->perm->getAllGroupsOptions([$categoryData->getGroupId()], $currentUser);
$restrictedGroupsOptions = $currentUser->perm->getAllGroupsOptions($groupPermission, $currentUser);
}

$templateVars = [
'header' => $header,
'categoryId' => $categoryId,
Expand All @@ -101,13 +108,13 @@
'categoryOwnerOptions' => $userHelper->getAllUserOptions($categoryData->getUserId()),
'isMediumPermission' => $faqConfig->get('security.permLevel') !== 'basic',
'categoryModeratorLabel' => Translation::get('ad_categ_moderator'),
'allGroupsOptions' => $currentUser->perm->getAllGroupsOptions([$categoryData->getGroupId()], $currentUser),
'allGroupsOptions' => $allGroupsOptions,
'categoryGroupPermissionLabel' => Translation::get('ad_entry_grouppermission'),
'allGroups' => $allGroups ? 'checked' : '',
'categoryGroupPermissionAllLabel' => Translation::get('ad_entry_all_groups'),
'restrictedGroups' => $restrictedGroups ? 'checked' : '',
'restrictedGroupsLabel' => Translation::get('ad_entry_restricted_groups'),
'restrictedGroupsOptions' => $currentUser->perm->getAllGroupsOptions($groupPermission, $currentUser),
'restrictedGroupsOptions' => $restrictedGroupsOptions,
'userPermissionLabel' => Translation::get('ad_entry_userpermission'),
'allUsers' => $allUsers ? 'checked' : '',
'allUsersLabel' => Translation::get('ad_entry_all_users'),
Expand Down

0 comments on commit 52cd023

Please sign in to comment.