fungus75 / ReadOnlyAccessBundle

Read Only Access Plugin for Kimai
MIT License
4 stars 6 forks source link

Some feedback #1

Closed kevinpapst closed 4 years ago

kevinpapst commented 4 years ago

Hi!

Really nice idea and a great start. I'd like to leave some initial feedback:

Just from a first look I'd say: replace the isGranted('view_readonly_customer') call in the MenuSubscriber and in the ReadOnlyAccessUserController with isGranted('ROLE_READONLYACCESS_USER'). Then you can remove the permission view_readonly_customer altogether.

Or you could even make it simpler: remove the role and the permission and inside the controller and MenuSubscriber you simply check if currentUser->getPreferenceValue("readOnlyAccessCustomer") !== null and use that to decide whether the menu should be displayed. Inside the ReadOnlyAccessUserController you could replace the isGranted with:

$customerId = $this->getUser()->getPreferenceValue("readOnlyAccessCustomer");
if (null === $customerId) {
    throw $this->createAccessDeniedException();
}

Just in case someone knows the URL.

Oh and finally: add some tags to your repository description like kimai2, kimai-plugins ... just check which ones are offered in the autocomplete dropdown. Then it can be found easier by other people.

fungus75 commented 4 years ago

Kevin, thank you for that ideas. I have adjusted it and it looks good... Still going to do some tests...

fungus75 commented 4 years ago

Kevin, from my point of view, this is fixed by now.

kevinpapst commented 4 years ago

Like that 👍 only two minor points: Customer shouldn't be deleted, but if ... you still get a 500. You should add in line 40, after this one:

    if ($customer === null) {
        throw $this->createNotFoundException();
    }

The menu icon ist still from the CustomCSSBundle, what about https://fontawesome.com/icons/book?style=solid ?

fungus75 commented 4 years ago

Also fixed and icon adjusted. Thanks for all that testing...

kevinpapst commented 4 years ago

Great work, really like it! Closing, thanks for having a look at my suggestions