-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Do not redirect in a JSON call but return a JSON string #10763
Conversation
I have tested this item ✅ successfully on 2b88f07 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10763. |
I have tested this item ✅ successfully on 2b88f07 The error message itself we could do better (permission to change, not view), but that is another PR. Found another bug. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10763. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10763. |
@roland-d we should have a nicer way to solve this and all permission js ajax issues. Already done that for sendtestmail js. IMHO what we really need is to catch the errors in the js (see https://github.com/joomla/joomla-cms/blob/staging/media/system/js/sendtestmail-uncompressed.js#L33-L66). So if we follow that path this change should not be done as it would be capched by the js as a HTTP 403 error. You can see that happening in sendtestmail I don't have time right now, but i can look into this when i have time. So if you want to go ahead and merge this, ok, it can be easily reverted in my future PR. |
@andrepereiradasilva You won't solve all the AJAX issues this way because they are completely unrelated except this one change. Further I disagree actually by putting back the old code and handle it via JS. The actual AJAX call is successful, the result of the operation isn't. When we are doing an AJAX request, Joomla shouldn't return an HTML page. The JSON response object has the option to return a message, so that is what is being used now. Finally, I do agree with adding the all the extra checks to the JS code in case the AJAX call is not successful. |
@andrepereiradasilva still to be completed. |
I know. Only ajax js issues. what i mean is when there is no error message because of ajax json issues.
IMHO Joomla should return 403 HTTP status page if it was no permissions.
Also the mimetype of the retuned AJAX call should be application/json and so on. I will make all those changes when i have time to make the PR. |
Summary of Changes
The storing of ACL permissions is always done through AJAX. When a user doesn't have permissions a redirect to the index.php happens but this has no effect in an AJAX call causing the call to die with no notice.
This change fixes that by returning a JSON call with the message to show to the user.
This is not the fix for allowing this user to make the change, just deal with the incorrect redirect.
Testing Instructions
Pretty please @andrepereiradasilva and @infograf768