Skip to content

Commit 35c42a6

Browse files
feat: allow FreeRADIUSUsers to be updated and replaced
1 parent 226dd9f commit 35c42a6

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ServicesFreeRADIUSUserEndpoint extends Endpoint {
1818
$this->url = '/api/v2/services/freeradius/user';
1919
$this->model_name = 'FreeRADIUSUser';
2020
$this->many = false;
21-
$this->request_method_options = ['GET', 'POST', 'DELETE'];
21+
$this->request_method_options = ['GET', 'POST', 'PATCH', 'DELETE'];
2222

2323
# Construct the parent Endpoint object
2424
parent::__construct();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ServicesFreeRADIUSUsersEndpoint extends Endpoint {
1818
$this->url = '/api/v2/services/freeradius/users';
1919
$this->model_name = 'FreeRADIUSUser';
2020
$this->many = true;
21-
$this->request_method_options = ['GET', 'DELETE'];
21+
$this->request_method_options = ['GET', 'PUT', 'DELETE'];
2222

2323
# Construct the parent Endpoint object
2424
parent::__construct();

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class FreeRADIUSUser extends Model {
6060
$this->motp_enable = new BooleanField(
6161
required: true,
6262
indicates_true: 'on',
63-
indicates_false: 'off',
63+
indicates_false: '',
6464
internal_name: 'varusersmotpenable',
6565
help_text: 'Enable or disable the use of Mobile One-Time Password (MOTP) for this user.',
6666
);
@@ -135,16 +135,9 @@ class FreeRADIUSUser extends Model {
135135
}
136136

137137
/**
138-
* Apply the creation of this User.
138+
* Apply the changes made to this Model to the FreeRADIUS configuration.
139139
*/
140-
public function apply_create(): void {
141-
freeradius_users_resync();
142-
}
143-
144-
/**
145-
* Apply the deletion of this User.
146-
*/
147-
public function apply_delete(): void {
140+
public function apply(): void {
148141
freeradius_users_resync();
149142
}
150143
}

0 commit comments

Comments
 (0)