Nodelist import update

This commit is contained in:
2024-06-15 14:23:05 +10:00
parent df2873287c
commit 941117b342
5 changed files with 241 additions and 232 deletions

View File

@@ -393,7 +393,7 @@ class Address extends Model
*/
public function scopeFTN($query)
{
return $query->select(['zone_id','host_id','node_id','point_id'])
return $query->select(['addresses.zone_id','host_id','node_id','point_id'])
->with('zone.domain');
}
@@ -775,6 +775,11 @@ class Address extends Model
return $this->role & self::NODE_HOLD;
}
public function getIsOwnedAttribute(): bool
{
return $this->system->is_owned;
}
public function getIsPrivateAttribute(): bool
{
return (! $this->system->address);
@@ -788,12 +793,12 @@ class Address extends Model
*/
public function getRoleIdAttribute(): int
{
static $warn= FALSE;
static $warn = FALSE;
$val = ($this->role & self::NODE_ALL);
$role = $this->ftn_role();
if ($this->isRoleOverride()) {
if ($this->isRoleOverride($role)) {
if (! $warn) {
$warn = TRUE;
Log::alert(sprintf('%s:! Address ROLE [%d] is not consistent with what is expected [%d] for [%s]',self::LOGKEY,$val,$role,$this->ftn));
@@ -1194,10 +1199,10 @@ class Address extends Model
return $o;
}
public function isRoleOverride(): bool
public function isRoleOverride(int $role=NULL): bool
{
$val = ($this->role & self::NODE_ALL);
$role = $this->ftn_role();
$role = $role ?: $this->ftn_role();
return ($val && ($role !== $val)) || (! $role);
}