From fff721dd185f5b97f7ae7a6e64189e55887ff590 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 05 Jul 2026 18:36:57 +0000
Subject: [PATCH] =Cleaning up the Square integration (still a bit more to do yet). Also majorly overhauled /rest/ files to ignore a rest request 'user' paramater, and rely on get_current_user_id() instead.
---
inc/rest/routes/SettingsRoutes.php | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/inc/rest/routes/SettingsRoutes.php b/inc/rest/routes/SettingsRoutes.php
index f49c2bd..66d1068 100644
--- a/inc/rest/routes/SettingsRoutes.php
+++ b/inc/rest/routes/SettingsRoutes.php
@@ -38,7 +38,8 @@
Route::for('settings')
->post([$this, 'saveSettings'])
->auth(PermissionHandler::combine(['admin', ['actionNonce' => 'dash-']]))
- ->rateLimit(20);
+ ->rateLimit(20)
+ ->register();
}
/**
@@ -50,10 +51,9 @@
{
$data = $request->get_params();
- error_log('User: '.print_r($data['user'], true));
- error_log('Settings routes data: '.print_r($data, true));
- $user_id = absint($data['user']??0);
- if ($user_id === 0) {
+
+ $user_id = get_current_user_id();
+ if (!$user_id) {
return $this->unauthorized();
}
@@ -144,6 +144,7 @@
}
$this->cache->flush();
}
+
return [
'success' => true,
'result' => $results,
--
Gitblit v1.10.0