kimai / Paid-plugins

Support for paid Kimai plugins: Discussions and feature requests
https://www.kimai.org/store/
11 stars 1 forks source link

Plugin - Custom Fields - Restrict Visibility Not Working #138

Closed corrigenda-admin closed 6 months ago

corrigenda-admin commented 6 months ago

Hi,

We have the "Custom Fields" plugin and its not working when we try to limit the visibility.

When we put in a Permission like "budget_team_activity" it works fine. But when we put in a full "Role" like "ROLE_ADMIN" it doesnt show when a member of that group goes to the screen.

I have tested it on your demo platform and get the same output incase it was just platform specific to us.

I have attached a screenshot of the name I have put in the restriction part but doesnt show at all on the screen.

image

corrigenda-admin commented 6 months ago

To add further to this. It seems to be when we allocate it to a custom created "Role", the system defined ones seem to be ok?

kevinpapst commented 6 months ago

I know I debugged that once, because someone had an issue like that before. Everything worked, but I can't really remember what the problem was, and on top of that I forgot to add that to the documentation.

Give me a bit of time, I will get back to you after testing.

Meanwhile please explain what ou mean by that:

it seems to be when we allocate it to a custom created "Role", the system defined ones seem to be ok?

corrigenda-admin commented 6 months ago

Thanks for the reply,

Sorry to explain further on my second comment.

If i put in the Restrict Visibility to "ROLE_ADMIN" it seems to work ok.

But, when i create a custom role "SOLENT" and allocate the user to that, and change the Restrict to "SOLENT" it doesnt show. So seems to be when I create roles? They are definitely following the same name.

I have attached some screenshots to try to help explain. Limit_Role_Admin Limit_Role_Admin_Working Permission _ SOLENT Role Group - Test - Not working Role Group _ Admin _ Working ROLES SOLENT _ Not showing

kevinpapst commented 6 months ago

Please try ROLE_SOLENT as name

corrigenda-admin commented 6 months ago

Thanks for the reply, I have just tried that, but still the same unfortunately.

When i inspect the names are showing as these, and the others show ROLE_

image

kevinpapst commented 6 months ago

Okay, found it. The important part of the documentation is here: https://www.kimai.org/documentation/permissions.html#creating-roles

Quote:

Custom role names must start with ROLE_ and need to be written in uppercase letters, so instead of using Manager you have to create ROLE_MANAGER. This is required if you want to test for role permissions programmatically.

I added it to the new chapter about "visibility of custom fields" here: https://www.kimai.org/documentation/plugin-custom-fields.html#visibility

corrigenda-admin commented 6 months ago

Fantastic, thank you so much!! Really appreciate the support. Love the work you do as well. Such a great program.

kevinpapst commented 6 months ago

Sorry that have to change your role name now 😊

But discussions like this one are important for me, so I can identify pieces in the documentation that are missing!