Filter available echoareas/fileareas based on security

This commit is contained in:
Deon George 2023-09-17 00:14:46 +10:00
parent 073fa466d6
commit e611dcbe11
1 changed files with 12 additions and 0 deletions

View File

@ -584,8 +584,14 @@ class SystemController extends Controller
return redirect()->back()->with('success','Echoareas updated');
}
// @todo Allow a NC/RC/ZC to override
$eo = Echoarea::active()
->where('domain_id',$ao->zone->domain_id)
->where(function($query) use ($ao) {
return $query
->whereRaw(sprintf('(security&7) <= %d',$ao->security)) // write
->orWhereRaw(sprintf('((security>>3)&7) <= %d',$ao->security)); // read
})
->orderBy('name')
->get();
@ -618,8 +624,14 @@ class SystemController extends Controller
return redirect()->back()->with('success','Fileareas updated');
}
// @todo Allow a NC/RC/ZC to override
$fo = Filearea::active()
->where('domain_id',$ao->zone->domain_id)
->where(function($query) use ($ao) {
return $query
->whereRaw(sprintf('(security&7) <= %d',$ao->security)) // write
->orWhereRaw(sprintf('((security>>3)&7) <= %d',$ao->security)); // read
})
->orderBy('name')
->get();