Implemented echoarea/filearea security

This commit is contained in:
2023-07-29 13:17:36 +10:00
parent f1ccca25ea
commit cd140971e2
22 changed files with 548 additions and 58 deletions

View File

@@ -112,18 +112,25 @@ class File extends Model
}
// See if we need to export this message.
$exportto = $model->filearea->addresses->pluck('id')->diff($model->set_seenby);
if ($model->filearea->sec_read) {
$exportto = $model
->filearea
->addresses
->filter(function($item) use ($model) { return $item->security >= $model->echoarea->sec_read; })
->pluck('id')
->diff($model->set_seenby);
if ($exportto->count()) {
if ($model->no_export) {
Log::debug(sprintf('%s:- NOT processing exporting of message by configuration [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(',')));
return;
if ($exportto->count()) {
if ($model->no_export) {
Log::debug(sprintf('%s:- NOT processing exporting of message by configuration [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(',')));
return;
}
Log::debug(sprintf('%s:- Exporting file [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(',')));
// Save the seenby for the exported systems
$model->seenby()->syncWithPivotValues($exportto,['export_at'=>Carbon::now()],FALSE);
}
Log::debug(sprintf('%s:- Exporting file [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(',')));
// Save the seenby for the exported systems
$model->seenby()->syncWithPivotValues($exportto,['export_at'=>Carbon::now()],FALSE);
}
});
}