Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Multicurrency API does not consider user's write permission #28251

Closed
iantun-x opened this issue Feb 18, 2024 · 1 comment
Closed

BUG: Multicurrency API does not consider user's write permission #28251

iantun-x opened this issue Feb 18, 2024 · 1 comment
Labels
Bug This is a bug (something does not work as expected)

Comments

@iantun-x
Copy link
Contributor

Bug

Even when user has the necessary permissions, API does not allow modifications on currency or rate.
I think I found the issue, I will submit a pull request shortly.

Environment Version

18.0.5

Environment OS

AlmaLinux 9

Environment Web server

Apache 2.4

Environment PHP

8.1

Environment Database

Mariadb 10.3.39

Environment URL(s)

No response

Expected and actual behavior

Expected results:

Response with successfully updated rate, as in this example:

{
"id": "2",
"name": "Euros (€)",
"code": "EUR",
"rate": {
"id": 11,
"rate": "1.01",
"date_sync": 1708196305
}
}

Actual results:

Response with error:

{
"error": {
"code": 401,
"message": "Unauthorized: Insufficient rights to update currency rate"
},
"debug": {
"source": "api_multicurrencies.class.php:311 at call stage",
"stages": {
"success": [
"get",
"route",
"negotiate",
"authenticate",
"validate"
],
"failure": [
"call",
"message"
]
}
}
}

Steps to reproduce the behavior

Enable multicurrency.
Create one currency other than the main currency. We'll assume it will receive ID = 2.
Create a user, non-administrator, and give it all permissions on module Multicurrency, and nothing else other than the default.
Give user an API Key.

The attached PHP script (issue.php) allows to reproduce the issue.

Attached files

issue.zip

@iantun-x iantun-x added the Bug This is a bug (something does not work as expected) label Feb 18, 2024
@Hystepik
Copy link
Contributor

It seems to be fixed so I close the issue.
Feel free to reopen if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

2 participants