Created a 'zc' role to be used when a user is a ZC of a domain, or a site admin
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 41s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m56s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
Deon George 2024-05-28 23:21:54 +10:00
parent 48ed6eb8ea
commit c414ebd053
2 changed files with 29 additions and 22 deletions

View File

@ -27,8 +27,10 @@ class AuthServiceProvider extends ServiceProvider
{
$this->registerPolicies();
Gate::define('admin',function (User $o) {
return $o->admin === TRUE;
});
// Mailer Admin
Gate::define('admin',fn(User $o)=>($o->admin === TRUE));
// ZC of a Zone
Gate::define('zc',fn(User $o)=>(($o->admin === TRUE) || $o->ZC()));
}
}

View File

@ -2,28 +2,33 @@
FTN Networks
@auth
<dl>
<dt>My Systems</dt>
@foreach ($user->systems->sortBy('name') as $o)
<dd><a href="{{ url('system/addedit',['id'=>$o->id]) }}">{{ $o->name }}</a></dd>
@endforeach
</dl>
@if($user->systems->count())
<dl>
<dt>My Systems</dt>
@foreach ($user->systems->sortBy('name') as $o)
<dd><a href="{{ url('system/addedit',['id'=>$o->id]) }}">{{ $o->name }}</a></dd>
@endforeach
</dl>
@endif
@endauth
<dl>
<dt>Explore Networks</dt>
@foreach (\App\Models\Domain::select(['id','name'])
->when(((! $user) || (! $user->isAdmin())),function($query) { return $query->public()->active(); })
->orderBy('name')
->get() as $o)
@if ($o->isManaged())
<dd><a href="{{ url('domain/view',['id'=>$o->id]) }}">{{ $o->name }}</a></dd>
@endif
@endforeach
</dl>
@if(($x=\App\Models\Domain::select(['id','name'])
->when(((! $user) || (! $user->isAdmin())),fn($query)=>$query->public()->active())
->orderBy('name')
->get())
->count())
<dl>
<dt>Explore Networks</dt>
@foreach ($x as $o)
@if ($o->isManaged())
<dd><a href="{{ url('domain/view',['id'=>$o->id]) }}">{{ $o->name }}</a></dd>
@endif
@endforeach
</dl>
@endif
@auth
@if ($user->isZC())
@can('zc')
<dl>
<dt>Network Admin</dt>
<dd><a href="{{ url('domain') }}">Domains</a></dd>
@ -32,7 +37,7 @@
<dd><a href="{{ url('echoarea') }}">Echoareas</a></dd>
<dd><a href="{{ url('filearea') }}">Fileareas</a></dd>
</dl>
@endif
@endcan
@can('admin')
<dl>