Allow non-admin users to see the organisations list (required for easier "Join" and "Register" requests). Filter the list to approved or memberOf organisations only.
This commit is contained in:
@@ -646,7 +646,16 @@ class OrganisationController extends SimpleController
|
||||
/** @var \UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
|
||||
$classMapper = $this->ci->classMapper;
|
||||
|
||||
$params['ci'] = $this->ci;
|
||||
|
||||
$sprunje = $classMapper->createInstance('organisation_sprunje', $classMapper, $params);
|
||||
if (!$currentUser->isMaster() && $currentUser->roles()->where('slug', 'organisations-admin')->count() == 0) {
|
||||
$sprunje->extendQuery(function ($query) use ($currentUser) {
|
||||
return $query->where('flag_approved', true)
|
||||
->withUser($currentUser->id)
|
||||
->orWhereNotNull('is_member');
|
||||
});
|
||||
}
|
||||
|
||||
// Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content.
|
||||
// For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating).
|
||||
|
||||
Reference in New Issue
Block a user