mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-09-19 17:27:25 -04:00
fix(sales): gate per-record endpoints behind reports_sales grant (#4627)
fix(sales): gate per-record endpoints behind reports_sales grant (REDACTED) Cashiers holding only the base `sales` grant could reach per-sale endpoints (getRow, getEdit, postSave, getReceipt, getInvoice, getSendPdf, getSendReceipt) that require `reports_sales`. getManage() enforced this at the list level, but individual endpoints did not re-check. Regression tests added. Auth: - Introduce `IsLoggedIn` filter to centralize login checks across controllers - Replace custom `AccessDeniedRedirectException` with built-in `RedirectException` Employees: - Add `DISALLOW_PASSWORD_CHANGE` and `DISALLOW_GRANT_CHANGE` env vars to restrict credential and permission changes in locked-down environments - Extract `hasGrantsChanged()` to streamline `postSave` Refactor: - Rename snake_case variables to camelCase in Sales, Items, and Employees controllers for PSR-12 compliance - Use explicit `db_connect()` for transaction clarity in Items controller Fixes: - SMTP config entries fall back to defaults via null coalescing - Migration uses `DROP FOREIGN KEY` instead of `DROP CONSTRAINT` - Password hash upgrade only sets session on successful `hash_version` update - Correct lang key for unknown error in Module model Language: - Translate `error_grant_change_disallowed` / `error_password_change_disallowed` across all 44 supported locales with => alignment matching en reference - Fix "cannot be deleted" messages and misc typos across ~15 language files Tests: - Bootstrap seeder only once in ItemsCsvImportTest; close connection after - Restore `DISALLOW_GRANT_CHANGE` in teardown to prevent side effects - Use `uniqid()` for test user data to avoid collisions Signed-off-by: 17935339+objecttothis@users.noreply.github.com
This commit is contained in:
1 parent
9ee530e454
commit
c701d21886
66 files changed
+3025
-2408
No files matched your search
@@ -32,10 +32,10 @@ class Module extends Model
|
||||
if ($query->getNumRows() == 1) { // TODO: ===
|
||||
$row = $query->getRow();
|
||||
|
||||
return lang($row->name_lang_key);
|
||||
return lang('Module.' . $row->module_id);
|
||||
}
|
||||
|
||||
return lang('Errors.unknown');
|
||||
return lang('Error.unknown');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,10 +50,10 @@ class Module extends Model
|
||||
if ($query->getNumRows() == 1) { // TODO: ===
|
||||
$row = $query->getRow();
|
||||
|
||||
return lang($row->desc_lang_key);
|
||||
return lang('Module.' . $row->module_id . '_desc');
|
||||
}
|
||||
|
||||
return lang('Errors.unknown');
|
||||
return lang('Error.unknown');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user