Skip to content

Commit d86f113

Browse files
style: run prettier on new files
1 parent 107f451 commit d86f113

8 files changed

Lines changed: 312 additions & 287 deletions

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Endpoints/ServicesFreeRADIUSClientEndpoint.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ class ServicesFreeRADIUSClientEndpoint extends Endpoint {
2424
parent::__construct();
2525
}
2626
}
27-

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Endpoints/ServicesFreeRADIUSClientsEndpoint.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ class ServicesFreeRADIUSClientsEndpoint extends Endpoint {
2424
parent::__construct();
2525
}
2626
}
27-

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Endpoints/ServicesFreeRADIUSInterfaceEndpoint.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ class ServicesFreeRADIUSInterfaceEndpoint extends Endpoint {
2424
parent::__construct();
2525
}
2626
}
27-

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Endpoints/ServicesFreeRADIUSInterfacesEndpoint.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ class ServicesFreeRADIUSInterfacesEndpoint extends Endpoint {
2424
parent::__construct();
2525
}
2626
}
27-

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Endpoints/VPNOpenVPNClientExportEndpoint.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class VPNOpenVPNClientExportEndpoint extends Endpoint {
1515
# Set Endpoint attributes
1616
$this->url = '/api/v2/vpn/openvpn/clientexport';
1717
$this->model_name = 'OpenVPNClientExport';
18-
$this->request_method_options = [ 'POST' ];
18+
$this->request_method_options = ['POST'];
1919
$this->many = false;
2020

2121
# Construct the parent Endpoint object

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/FreeRADIUSClient.inc

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use RESTAPI\Validators\RegexValidator;
2323
* Defines a Model that represents FreeRADIUS Interfaces
2424
*/
2525
class FreeRADIUSClient extends Model {
26-
2726
public StringField $addr;
2827
public PortField $port;
2928
public StringField $type;
@@ -51,98 +50,112 @@ class FreeRADIUSClient extends Model {
5150
required: true,
5251
unique: true,
5352
validators: [new IPAddressValidator(allow_ipv4: true, allow_ipv6: true)],
54-
help_text: 'The IP address or network of the RADIUS client(s) in CIDR notation. This is the IP of the NAS (switch, access point, firewall, router, etc.)'
53+
help_text: 'The IP address or network of the RADIUS client(s) in CIDR notation. This is the IP of the NAS (switch, access point, firewall, router, etc.)',
5554
);
5655
$this->ipv = new StringField(
5756
internal_name: 'varclientipversion',
58-
choices: [ 'ipaddr', 'ipv6addr' ],
57+
choices: ['ipaddr', 'ipv6addr'],
5958
allow_empty: true,
6059
default: 'ipaddr',
61-
help_text: 'The IP version of the this Client.'
60+
help_text: 'The IP version of the this Client.',
6261
);
6362
$this->shortname = new StringField(
6463
internal_name: 'varclientshortname',
6564
required: true,
6665
allow_null: false,
67-
help_text: 'A short name for the client. This is generally the hostname of the NAS.'
66+
help_text: 'A short name for the client. This is generally the hostname of the NAS.',
6867
);
6968
$this->secret = new StringField(
7069
internal_name: 'varclientsharedsecret',
7170
required: true,
7271
sensitive: true,
7372
allow_empty: false,
74-
help_text: 'This is the shared secret (password) which the NAS (switch, accesspoint, etc.) needs to communicate with the RADIUS server.'
73+
help_text: 'This is the shared secret (password) which the NAS (switch, accesspoint, etc.) needs to communicate with the RADIUS server.',
7574
);
7675

7776
$this->proto = new StringField(
7877
internal_name: 'varclientproto',
7978
choices: ['udp', 'tcp'],
8079
allow_empty: true,
8180
default: 'udp',
82-
help_text: 'The protocol the client uses. (Default: udp)'
81+
help_text: 'The protocol the client uses. (Default: udp)',
8382
);
8483
$this->nastype = new StringField(
8584
internal_name: 'varclientnastype',
86-
choices: ['cisco', 'cvx', 'computone', 'digitro', 'livingston', 'juniper', 'max40xx', 'mikrotik', 'mikrotik_snmp', 'dot1x', 'other'],
85+
choices: [
86+
'cisco',
87+
'cvx',
88+
'computone',
89+
'digitro',
90+
'livingston',
91+
'juniper',
92+
'max40xx',
93+
'mikrotik',
94+
'mikrotik_snmp',
95+
'dot1x',
96+
'other',
97+
],
8798
allow_empty: true,
8899
default: 'other',
89-
help_text: 'The NAS type of the client. This is used by checkrad.pl for simultaneous use checks. (Default: other)'
100+
help_text: 'The NAS type of the client. This is used by checkrad.pl for simultaneous use checks. (Default: other)',
90101
);
91102
$this->msgauth = new StringField(
92103
internal_name: 'varrequiremessageauthenticator',
93104
choices: ['yes', 'no'],
94105
default: 'no',
95-
help_text: 'RFC5080 requires Message-Authenticator in Access-Request. But older NAS (switches or accesspoints) do not include that. (Default: no)'
106+
help_text: 'RFC5080 requires Message-Authenticator in Access-Request. But older NAS (switches or accesspoints) do not include that. (Default: no)',
96107
);
97108
$this->maxconn = new IntegerField(
98109
internal_name: 'varclientmaxconnections',
99110
minimum: 1,
100111
maximum: 32,
101112
default: 16,
102-
help_text: 'Takes only effect if you use TCP as protocol. Limits the number of simultaneous TCP connections from a client. (max=32)'
113+
help_text: 'Takes only effect if you use TCP as protocol. Limits the number of simultaneous TCP connections from a client. (max=32)',
103114
);
104115
$this->naslogin = new StringField(
105116
internal_name: 'varclientlogininput',
106117
allow_empty: true,
107118
default: '',
108-
help_text: 'If supported by your NAS, you can use SNMP or finger for simultaneous-use checks instead of (s)radutmp file and accounting. Leave empty to choose (s)radutmp. (Default: empty) '
119+
help_text: 'If supported by your NAS, you can use SNMP or finger for simultaneous-use checks instead of (s)radutmp file and accounting. Leave empty to choose (s)radutmp. (Default: empty) ',
109120
);
110-
$this->naspassword= new StringField(
121+
$this->naspassword = new StringField(
111122
internal_name: 'varclientpasswordinput',
112123
allow_empty: true,
113124
default: '',
114125
sensitive: true,
115126
help_text: 'If supported by your NAS, you can use SNMP or finger for simultaneous-use checks instead of (s)radutmp file and accounting. Leave empty to choose
116-
(s)radutmp. (Default: empty) '
127+
(s)radutmp. (Default: empty) ',
117128
);
118129

119130
$this->description = new StringField(
120131
required: false,
121132
allow_empty: true,
122-
default: "",
133+
default: '',
123134
validators: [
124-
new RegexValidator(pattern: "/^[a-zA-Z0-9 _,.;:+=()-]*$/", error_msg: 'Value contains invalid characters.'),
135+
new RegexValidator(
136+
pattern: "/^[a-zA-Z0-9 _,.;:+=()-]*$/",
137+
error_msg: 'Value contains invalid characters.',
138+
),
125139
],
126-
help_text: 'The description for this interface.'
140+
help_text: 'The description for this interface.',
127141
);
128142

129143
parent::__construct($id, $parent_id, $data, ...$options);
130144
}
131145

132-
133146
/**
134147
* Perform additional validation on the Model's fields and data.
135148
*/
136149
public function validate_extra(): void {
137150
$input_errors = [];
138151

139-
/*
140-
*/
152+
/*
153+
*/
141154
$iface_addr = $this->addr->value;
142-
if ( $iface_addr != '*' ) {
143-
if ( is_ipaddrv4($iface_addr) ) {
155+
if ($iface_addr != '*') {
156+
if (is_ipaddrv4($iface_addr)) {
144157
$this->ipv->value = 'ipaddr';
145-
} elseif ( is_ipaddrv6($iface_addr) ) {
158+
} elseif (is_ipaddrv6($iface_addr)) {
146159
$this->ipv->value = 'ipv6addr';
147160
} else {
148161
// we don't must be here because Model validator for $this->addr
@@ -165,7 +178,6 @@ class FreeRADIUSClient extends Model {
165178
}
166179
}
167180

168-
169181
/**
170182
* Apply specific action on Client(s)
171183
*/

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/FreeRADIUSInterface.inc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use RESTAPI\Validators\RegexValidator;
2323
* Defines a Model that represents FreeRADIUS Interfaces
2424
*/
2525
class FreeRADIUSInterface extends Model {
26-
2726
public StringField $addr;
2827
public PortField $port;
2928
public StringField $type;
@@ -51,56 +50,58 @@ class FreeRADIUSInterface extends Model {
5150
internal_name: 'varinterfaceip',
5251
required: true,
5352
validators: [new IPAddressValidator(allow_ipv4: true, allow_ipv6: true, allow_keywords: ['*'])],
54-
help_text: 'The IP address of the listening interface. If you choose * then it means all interfaces.'
53+
help_text: 'The IP address of the listening interface. If you choose * then it means all interfaces.',
5554
);
5655
$this->port = new PortField(
5756
internal_name: 'varinterfaceport',
5857
required: false,
5958
allow_alias: false,
6059
allow_range: false,
6160
default: '1812',
62-
help_text: 'The port number of the listening interface. Different interface types need different ports.'
61+
help_text: 'The port number of the listening interface. Different interface types need different ports.',
6362
);
6463
$this->type = new StringField(
6564
internal_name: 'varinterfacetype',
6665
required: false,
67-
choices: [ 'auth', 'acct' ],
66+
choices: ['auth', 'acct'],
6867
default: 'auth',
69-
help_text: 'The type of the listening interface: Authentication/Accounting.'
68+
help_text: 'The type of the listening interface: Authentication/Accounting.',
7069
);
7170
$this->ipv = new StringField(
7271
internal_name: 'varinterfaceipversion',
73-
choices: [ 'ipaddr', 'ipv6addr' ],
72+
choices: ['ipaddr', 'ipv6addr'],
7473
allow_empty: true,
7574
required: true,
76-
conditions: [ 'addr' => '*' ],
77-
help_text: 'The IP version of the listening interface.'
75+
conditions: ['addr' => '*'],
76+
help_text: 'The IP version of the listening interface.',
7877
);
7978
$this->description = new StringField(
8079
required: false,
8180
allow_empty: true,
82-
default: "",
81+
default: '',
8382
validators: [
84-
new RegexValidator(pattern: "/^[a-zA-Z0-9 _,.;:+=()-]*$/", error_msg: 'Value contains invalid characters.'),
83+
new RegexValidator(
84+
pattern: "/^[a-zA-Z0-9 _,.;:+=()-]*$/",
85+
error_msg: 'Value contains invalid characters.',
86+
),
8587
],
86-
help_text: 'The description for this interface.'
88+
help_text: 'The description for this interface.',
8789
);
8890

8991
parent::__construct($id, $parent_id, $data, ...$options);
9092
}
9193

92-
9394
/**
9495
* Perform additional validation on the Model's fields and data.
9596
*/
9697
public function validate_extra(): void {
9798
$input_errors = [];
9899

99100
$iface_addr = $this->addr->value;
100-
if ( $iface_addr != '*' ) {
101-
if ( is_ipaddrv4($iface_addr) ) {
101+
if ($iface_addr != '*') {
102+
if (is_ipaddrv4($iface_addr)) {
102103
$this->ipv->value = 'ipaddr';
103-
} elseif ( is_ipaddrv6($iface_addr) ) {
104+
} elseif (is_ipaddrv6($iface_addr)) {
104105
$this->ipv->value = 'ipv6addr';
105106
} else {
106107
// we don't must be here because Model validator for $this->addr
@@ -123,7 +124,6 @@ class FreeRADIUSInterface extends Model {
123124
}
124125
}
125126

126-
127127
/**
128128
* Apply the action on Interface(s)
129129
*/

0 commit comments

Comments
 (0)