Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghelupu17 committed Oct 20, 2023
1 parent cc7e129 commit 319455a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 8 additions & 1 deletion app/Http/Controllers/OrganizationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ public function index(Request $request)

public function show(Organization $organization)
{
$this->authorize('view', $organization);
if (!$organization->isActive()) {
if (!auth()->check() ) {
abort(404);
}
if (!auth()->user()->belongsToOrganization($organization)) {
abort(404);
}
}

return Inertia::render('Public/Organizations/Show', [
'organization' => new ShowOrganizationResource(
Expand Down
7 changes: 1 addition & 6 deletions app/Policies/OrganizationPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace App\Policies;

use App\Enums\OrganizationStatus;
use App\Models\Organization;
use App\Models\User;

Expand All @@ -25,11 +24,7 @@ public function viewAny(User $user): bool
public function view(User $user, Organization $organization): bool
{
/* Anyone can see the details of an organization. */
if ($organization->isActive())
{
return true;
}
return $user->isSuperUser() || $user->isOrganizationAdmin($organization);
return true;
}

/**
Expand Down

0 comments on commit 319455a

Please sign in to comment.