KatjaGlassConsulting / ApprovalBundle

A Kimai Plugin to manage weekly approval workflow
MIT License
11 stars 14 forks source link

Team lead does not see approval requests #12

Closed levino closed 1 year ago

levino commented 1 year ago

When I request an approval as a team member, only the admin sees the request, not the team lead. It worked in the beginning but then I changed some values for the role "Activity (Team member)" (and changed the settings back) and it looks that since then it stopped working. How can I debug the missing "Hours approval" entry for the team lead? Email is sent (however with an incorrect host in the url and when I fix the host, I get 404).

KatjaGlassConsulting commented 1 year ago

With respect to mailing, the Kimai functionality is used. So when Kimai sends mails with the correct host and everything, then the approval bundle would be able to do the same. For Kimai you could click "forgot password" to trigger e-mail sending.

For the link in the mail, there is a plugin setting "Approval" -> "Setting" -> "E-Mail-Link url". You might enter something like https://kimai.mydomain.de/

When you browse to the approval week, you can also see the correct URL, for example: https://kimai.mydomain.de/de/approval-report/week_by_user?user=15&date=2022-08-01.

Make also sure to have setup the teams in Kimai -> System -> Teams.

levino commented 1 year ago

Thank you for the swift response @KatjaGlassConsulting Unfortunately my OP might have been a little misleading. The problem is not the email notification (the link is broken, but that is a different story, thank you for already pointing out how to fix that) but the notification with the kimai web app itself. I recorded a video (the quality should become better around 9am, 24th of January, Berlin time) with the problem. It is not long and it should be much better to understand than trying to describe the problem in words. I am mainly interested in how to debug, as I guess this is some misconfiguration on my end and hard for you to remote debug.

KatjaGlassConsulting commented 1 year ago

It seems your team lead is no longer counted as team lead, as it only sees what a normal users see and not what a teamlead/admin can see - the teamlead sees a few users, the admin all.

image

To be able to see this, the teamlead must have one of the following roles: @Security("is_granted('view_team_approval') or is_granted('view_all_approval') Maybe you didn't change all back? It all depends on 'view_team_approval' for this teamlead.

image

This security role check is deeply integrated in the framework. You could print the return value of this function, you can update ApprovalBundle\Controller\WeekReportController.php in line 91ff and replace the file-path/name with something appropriate:

    private function canManageTeam(): bool
    {
        file_put_contents("C:/log_this_issue.txt", json_encode($this->isGranted('view_team_approval')) . "\n");
        return $this->isGranted('view_team_approval');
    }
levino commented 1 year ago

Thank you for the feed back. Setting the roles as you suggested fixed the issue. Thank you a lot!