mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 16:14:40 +00:00
VPN: IPsec: Connections - remote authentication. Add support for radis class groups, fix missing mapping in 928d2f8299 for https://github.com/opnsense/core/issues/3295
This commit is contained in:
parent
1dab8ca715
commit
af46866998
@ -30,6 +30,7 @@ namespace OPNsense\IPsec;
|
||||
|
||||
use Phalcon\Messages\Message;
|
||||
use OPNsense\Base\BaseModel;
|
||||
use OPNsense\Core\Config;
|
||||
use OPNsense\Firewall\Util;
|
||||
|
||||
/**
|
||||
@ -38,6 +39,27 @@ use OPNsense\Firewall\Util;
|
||||
*/
|
||||
class Swanctl extends BaseModel
|
||||
{
|
||||
/**
|
||||
* convert group ids to group (class) names
|
||||
*/
|
||||
private function gidToNames($gids)
|
||||
{
|
||||
$result = [];
|
||||
$cnf = Config::getInstance()->object();
|
||||
$mapping = [];
|
||||
if (isset($cnf->system->group)) {
|
||||
foreach ($cnf->system->group as $group) {
|
||||
$mapping[(string)$group->gid] = (string)$group->name;
|
||||
}
|
||||
}
|
||||
foreach (explode(',', $gids) as $gid) {
|
||||
if (!empty($mapping[$gid])) {
|
||||
$result[] = $mapping[$gid];
|
||||
}
|
||||
}
|
||||
return implode(',', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -175,6 +197,8 @@ class Swanctl extends BaseModel
|
||||
$pool_names[$node_uuid] = (string)$attr;
|
||||
}
|
||||
continue;
|
||||
} elseif (is_a($attr, 'OPNsense\Base\FieldTypes\AuthGroupField')) {
|
||||
$thisnode[$attr_name] = $this->gidToNames((string)$attr);
|
||||
} elseif (is_a($attr, 'OPNsense\Base\FieldTypes\BooleanField')) {
|
||||
$thisnode[$attr_name] = (string)$attr == '1' ? 'yes' : 'no';
|
||||
} elseif (is_a($attr, 'OPNsense\Base\FieldTypes\CertificateField')) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user