Fixed check for has_organisation

This commit is contained in:
2023-08-23 08:39:27 +01:00
parent 1e0f2017f6
commit daa4e78a27

View File

@@ -67,8 +67,10 @@ class ServicesProvider
*/ */
$authorizer->addCallback('has_organisation', function ($user_id) { $authorizer->addCallback('has_organisation', function ($user_id) {
$query = Capsule::table('organisation_members') $query = Capsule::table('organisation_members')
->join('organisations', 'organisation_members.organisation_id', 'organisations.id')
->where('user_id', $user_id) ->where('user_id', $user_id)
->where('flag_approved', true); ->where('organisation_members.flag_approved', true)
->where('organisations.flag_approved', true);
return $query->count() > 0; return $query->count() > 0;
}); });
@@ -104,8 +106,9 @@ class ServicesProvider
return Capsule::table('organisation_members') return Capsule::table('organisation_members')
->where('user_id', $user_id) ->where('user_id', $user_id)
->where('organisation_id', $organisation_id) ->where('organisation_id', $organisation_id)
->where('flag_admin', true) ->where('flag_admin', true);
->count() > 0;
return $query->count() > 0;
}); });
/* /*