Implemented echoarea/filearea security
This commit is contained in:
@@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Notification;
|
||||
|
||||
use App\Classes\FTN\Message;
|
||||
use App\Models\{Address,Echoarea,Echomail,Netmail,Setup};
|
||||
use App\Notifications\Netmails\Reject;
|
||||
use App\Notifications\Netmails\{EchoareaNotExist,EchoareaNotSubscribed,EchoareaNoWrite,Reject};
|
||||
|
||||
class MessageProcess implements ShouldQueue
|
||||
{
|
||||
@@ -195,6 +195,8 @@ class MessageProcess implements ShouldQueue
|
||||
|
||||
if (! $ea) {
|
||||
Log::alert(sprintf('%s:! Echoarea [%s] doesnt exist for zone [%d]',self::LOGKEY,$this->msg->echoarea,$this->msg->fboss_o->zone->zone_id));
|
||||
|
||||
Notification::route('netmail',$this->msg->fftn_o)->notify(new EchoareaNotExist($this->msg));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -251,9 +253,17 @@ class MessageProcess implements ShouldQueue
|
||||
}
|
||||
|
||||
// @todo Can the sender create it if it doesnt exist?
|
||||
// @todo Can the sender send messages to this area?
|
||||
// - Create it, or
|
||||
// - Else record in bad area
|
||||
|
||||
// Can the system send messages to this area?
|
||||
if (! $ea->sec_write || ($this->msg->fftn_o->security < $ea->sec_write)) {
|
||||
Notification::route('netmail',$this->msg->fftn_o)->notify(new EchoareaNoWrite($this->msg));
|
||||
return;
|
||||
}
|
||||
|
||||
// If the node is not subsccribed
|
||||
if ($this->msg->fftn_o->echoareas->search(function($item) use ($ea) { return $item->id === $ea->id; }) === FALSE) {
|
||||
Notification::route('netmail',$this->msg->fftn_o)->notify(new EchoareaNotSubscribed($this->msg));
|
||||
}
|
||||
|
||||
// We know about this area, store it
|
||||
$o = new Echomail;
|
||||
|
Reference in New Issue
Block a user