User roles management still missing

SupportUser roles management still missing
Lars asked 3 years ago
After 3 years "on top of the list" this feature is still missing or how can we allow non-admins to change settings/configuration of appointments? https://easy-appointments.com/support/user-permissions-editor/
4 Answers
Nikola Loncar Staff answered 3 years ago
Hi Lars it is not yet added. If you want quick fix for that one we can expose hooks for accessing pages depending on roles so you can alter rights on the fly. But you will need additional code from your side for using hooks. Best regards, Nikola
Lars Staff replied 3 years ago

That would be very helpful. Currently I hardcoded it into the plugin (not update-proof)
Can you post/send the hooks, please?

Lars Staff replied 3 years ago

Havent heard from you. Can you provide the code, please?

Lars Staff replied 3 years ago

What do you mean by “quick fix”? 😀
2 weeks, not yet one reply

Nikola Loncar Staff answered 3 years ago
Hi Lars, sorry for that we are planning new release by end of this week. There were some delays. Best regards, Nikola
Lars Staff replied 3 years ago

Okay there is finally your update but still lacking the code you were mentioning more than a month ago.

Lars Staff replied 3 years ago

wow, what a big disappointment this is. 2 months. promises but no help in the end.

Lars Staff replied 3 years ago

3 new updates since you said you would offer us the needed part of code.
Is this a joke to you?

Nikola Loncar Staff replied 3 years ago

Hi, sorry for waiting 🙁 we will release next version within next 24 hours with only that code improvement.

Best regards,
Nikola

Lars Staff replied 3 years ago

Hi. I see a new version but not settings or info what to change.
ajax.php contains “manage_posts”,
admin.php contains a “user_capability_callback” but also no backend settings/infos

Lars Staff replied 3 years ago

After searching the docs, there is a small info about the new filter but it’s totally incomplete.
What is the purpose of showing the menu slugs to special user roles when the ajax call is forbidden and so NO content at all is shown at each menu slug.

ajax.php line 1085: private function validate_access_rights()

This must be filtered and probably line 107, too.

Did you even test this before you release it?

Nikola Loncar Staff answered 3 years ago
Hi Lars, it will be also applied there as well (ajax cals). We will release fix for it during the day. Best regards, Nikola
Lars Staff replied 3 years ago

After updating to the latest version and using the filter, none of the ajax calls work anymore

Error 400 response
Response is: 0
Example: wp-admin/admin-ajax.php?=&_wpnonce=2705a95683&action=ea_services

Nikola Loncar Staff answered 3 years ago
Hi Lars it has been updated. There is additional hook for ajax admin part. More on that on Hooks and callbacks Best regards, Nikola
Lars Staff replied 3 years ago

Thanks for fixing the ajax call but now everything is broken. When trying to access the top menu, it says “you are not allowed to view the page” This code is in the functions and worked before the latest update:

add_filter(‘easy-appointments-user-menu-capabilities’, ‘custom_capabilities’, 10, 2);
function custom_capabilities($default_capability, $menu_slug) {
$menus = array(‘easy_app_top_level’,’easy_app_locations’,’easy_app_services’,’easy_app_workers’,’easy_app_connections’,’easy_app_vacation’,’easy_app_reports’,’easy_app_new_reports’);
return ( current_user_can( ‘manage_woocommerce’ ) && in_array($menu_slug,$menus) ) ? ‘manage_woocommerce’ : $default_capability;
}

Lars Staff replied 3 years ago

Same for the ajax call on a submenu page:
Error 400 response

Example: wp-admin/admin-ajax.php?=&_wpnonce=2705a95683&action=ea_services
Response is: 0

I really wonder if my approach is faulty or you do not test this at all?

Lars Staff replied 3 years ago

Can you check this. please? Ajax Calls are not working with the new hook.

Lars Staff replied 3 years ago

Hello?

Lars Staff replied 3 years ago

Why even ask…