mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 01:54:49 +00:00
Firewall/alias, isAlias() should use same object to avoid validation issues, closes https://github.com/opnsense/core/issues/2897
This commit is contained in:
parent
fba9b8ab2e
commit
bf2473db79
@ -74,6 +74,16 @@ class Util
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* use provided alias object instead of creating one. When modifying multiple aliases referencing each other
|
||||
* we need to use the same object for validations.
|
||||
* @param Alias $alias object to link
|
||||
*/
|
||||
public static function attachAliasObject($alias)
|
||||
{
|
||||
self::$aliasObject = $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* check if name exists in alias config section
|
||||
* @param string $name name
|
||||
|
||||
@ -31,6 +31,7 @@ namespace OPNsense\Firewall;
|
||||
|
||||
use OPNsense\Base\BaseModel;
|
||||
use OPNsense\Core\Config;
|
||||
use OPNsense\Firewall\Util;
|
||||
|
||||
/**
|
||||
* Class Alias
|
||||
@ -133,6 +134,7 @@ class Alias extends BaseModel
|
||||
*/
|
||||
public function refactor($oldname, $newname)
|
||||
{
|
||||
Util::attachAliasObject($this);
|
||||
// replace in legacy config
|
||||
foreach ($this->searchConfig($oldname) as $item) {
|
||||
$item[2][0] = $newname;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user