Removed hasRole twig function

This commit is contained in:
bwilliams committed 2023-06-06 15:48:53 +01:00
1 parent 3d21ab4950
commit b7d15dc25e
1 file changed
+1 -5
+1 -5
View File
@@ -66,18 +66,14 @@ class OrganisationsExtension extends AbstractExtension implements GlobalsInterfa
return Capsule::table('organisation_members') return Capsule::table('organisation_members')
->where('user_id', $currentUser->id) ->where('user_id', $currentUser->id)
->where('organisation_id', $organisation->id) ->where('organisation_id', $organisation->id)
->where('flag_admin', true)
->where('flag_approved', true) ->where('flag_approved', true)
->where('flag_admin', true)
->count() > 0; ->count() > 0;
}), }),
new TwigFunction('isOrganisationRegistrant', function ($organisation) { new TwigFunction('isOrganisationRegistrant', function ($organisation) {
$currentUser = $this->services->currentUser; $currentUser = $this->services->currentUser;
return $organisation->registrant_id == $currentUser->id; return $organisation->registrant_id == $currentUser->id;
}), }),
new TwigFunction('hasRole', function ($roleSlug) {
$currentUser = $this->services->currentUser;
return $currentUser->roles()->where('slug', $roleSlug)->count() > 0;
}),
]; ];
} }