Skip to content

Commit

Permalink
ルールが存在するアクセスルールグループの削除を制限 (#3384)
Browse files Browse the repository at this point in the history
  • Loading branch information
seto1 authored Apr 25, 2024
1 parent 0b4f088 commit 4b851ae
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@ public function getViewVarsForForm(int $userGroupId, EntityInterface $entity): a
if($userGroupId) {
$currentUserGroup = $this->UserGroups->get($userGroupId);
}
$isDeletable = false;
if ($entity->id) {
$isDeletable = !$this->PermissionGroups->Permissions
->exists(['Permissions.permission_group_id' => $entity->id]);
}
return [
'entity' => $entity,
'userGroupTitle' => $currentUserGroup->title?? __d('baser_core', 'ゲスト'),
'userGroupId' => $currentUserGroup->id ?? "0"
'userGroupId' => $currentUserGroup->id ?? '0',
'isDeletable' => $isDeletable,
];
}

Expand Down
22 changes: 12 additions & 10 deletions plugins/bc-admin-third/templates/Admin/PermissionGroups/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,18 @@
]) ?>
</div>
<div class="bca-actions__sub">
<?= $this->BcAdminForm->postLink(
__d('baser_core', '削除'),
['action' => 'delete', $userGroupId, $entity->id],
['block' => true,
'confirm' => __d('baser_core', '{0} を本当に削除してもいいですか?', $entity->name),
'class' => 'bca-submit-token button bca-btn bca-actions__item',
'data-bca-btn-type' => 'delete',
'data-bca-btn-size' => 'sm'
]
) ?>
<?php if ($isDeletable): ?>
<?= $this->BcAdminForm->postLink(
__d('baser_core', '削除'),
['action' => 'delete', $userGroupId, $entity->id],
['block' => true,
'confirm' => __d('baser_core', '{0} を本当に削除してもいいですか?', $entity->name),
'class' => 'bca-submit-token button bca-btn bca-actions__item',
'data-bca-btn-type' => 'delete',
'data-bca-btn-size' => 'sm'
]
) ?>
<?php endif ?>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,15 @@
</tr>
<?php endif ?>

<?php /* ?>
<tr>
<th class="col-head bca-form-table__label"><?php echo $this->BcAdminForm->label('status', __d('baser_core', '利用状態')) ?></th>
<td class="col-input bca-form-table__input">
<?php echo $this->BcAdminForm->control('status', ['type' => 'checkbox', 'label' => __d('baser_core', '有効')]) ?>
<?php echo $this->BcAdminForm->error('status') ?>
</td>
</tr>
<?php */ ?>
</table>
</div>

Expand Down

0 comments on commit 4b851ae

Please sign in to comment.