Re-built organisation permissions

This commit is contained in:
2023-06-07 13:41:14 +01:00
parent 0ca0f83ac4
commit 522718f7ee
10 changed files with 277 additions and 221 deletions

View File

@@ -1116,19 +1116,22 @@ class OrganisationController extends SimpleController
$tableColumns = [ 'description' ];
if ($currentUser->organisations(true)->count() == 0) {
if (
(
$currentUser->organisations(true)->count() == 0
|| !$config['organisation']['membership']['single_membership']
)
&& !$config['organisation']['combine_action_buttons']
) {
$tableColumns[] = 'join';
} else {
if (!$config['organisation']['membership']['single_membership']) {
$tableColumns[] = 'join';
}
}
if ($currentUser->organisations(true)->wherePivot('flag_admin', true) |
$authorizer->checkAccess($currentUser, 'delete_organisation') |
$authorizer->checkAccess($currentUser, 'update_organisation_field') |
$authorizer->checkAccess($currentUser, 'approve_organisation') |
$authorizer->checkAccess($currentUser, 'merge_organisations')) {
if ($currentUser->organisations(true)->wherePivot('flag_admin', true)
|| $authorizer->checkAccess($currentUser, 'delete_organisation')
|| $authorizer->checkAccess($currentUser, 'update_organisation_field')
|| $authorizer->checkAccess($currentUser, 'approve_organisation')
|| $authorizer->checkAccess($currentUser, 'merge_organisations')
|| $config['organisation']['combine_action_buttons']) {
$tableColumns[] = 'status';
$tableColumns[] = 'actions';
}