Skip to content

Commit e2ae2e9

Browse files
fix: fixed broken priv handling in Plus 24.11
This corrects the handling of pfSense's getUserEntry return value. Starting in 24.11, this returns the user entry nested under an 'item' key.
1 parent 80b14c9 commit e2ae2e9

File tree

1 file changed

+8
-1
lines changed
  • pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Core

1 file changed

+8
-1
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Core/Auth.inc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,14 @@ class Auth {
162162
public function authorize(): bool {
163163
# Variables
164164
$is_not_authorized = false;
165-
$this->client_privileges = get_user_privileges(getUserEntry($this->username));
165+
166+
# Start with pfSense 24.11, getUserEntry returns an array with the key 'item' containing the user data.
167+
# We need to handle both cases to support both.
168+
$user_ent = getUserEntry($this->username);
169+
$user_ent = (array_key_exists('item', $user_ent)) ? $user_ent['item'] : $user_ent;
170+
171+
# Obtain the client's privileges and check if they have the required privileges
172+
$this->client_privileges = get_user_privileges($user_ent);
166173

167174
# This client is not authorized if the client does not have at least one of the required privileges
168175
if ($this->required_privileges and !array_intersect($this->required_privileges, $this->client_privileges)) {

0 commit comments

Comments
 (0)