From c204185ae86a98994f80010abf35a190c9406739 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 12 Jul 2026 18:08:19 +0000
Subject: [PATCH] =Refactor of Integrations.php. Separated different functionality into traits that classes can use to add that functionality. Hopefully will make maintaining it a little easier. Still have to finish up, as well as refactoring the individual classes to utilize the new system.
---
inc/rest/PermissionHandler.php | 21 ++-------------------
1 files changed, 2 insertions(+), 19 deletions(-)
diff --git a/inc/rest/PermissionHandler.php b/inc/rest/PermissionHandler.php
index eb87fd0..4c41989 100644
--- a/inc/rest/PermissionHandler.php
+++ b/inc/rest/PermissionHandler.php
@@ -30,23 +30,6 @@
);
}
- $requestedUserId = $request->get_param('user');
-
- // No user param specified - allow (controller will handle)
- if (empty($requestedUserId)) {
- return true;
- }
-
- $currentUserId = get_current_user_id();
-
- if ((int) $requestedUserId !== $currentUserId) {
- return new WP_Error(
- 'forbidden',
- 'You can only access your own resources',
- ['status' => 403]
- );
- }
-
return true;
}
@@ -348,8 +331,8 @@
*/
public static function verifyActionNonce(WP_REST_Request $request, string $actionPrefix, string $header = 'X-Action-Nonce'): bool|WP_Error
{
- $userId = absint($request->get_param('user'));
- if ($userId === 0) {
+ $userId = get_current_user_id();
+ if (!$userId) {
return false;
}
--
Gitblit v1.10.0