Removed hasRole twig function

This commit is contained in:
2023-06-06 15:48:53 +01:00
parent 3d21ab4950
commit b7d15dc25e

View File

@@ -66,18 +66,14 @@ class OrganisationsExtension extends AbstractExtension implements GlobalsInterfa
return Capsule::table('organisation_members')
->where('user_id', $currentUser->id)
->where('organisation_id', $organisation->id)
->where('flag_admin', true)
->where('flag_approved', true)
->where('flag_admin', true)
->count() > 0;
}),
new TwigFunction('isOrganisationRegistrant', function ($organisation) {
$currentUser = $this->services->currentUser;
return $organisation->registrant_id == $currentUser->id;
}),
new TwigFunction('hasRole', function ($roleSlug) {
$currentUser = $this->services->currentUser;
return $currentUser->roles()->where('slug', $roleSlug)->count() > 0;
}),
];
}