KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Help with permission object please #2434

Closed Wayland Games opened this topic on on Nov 15, 2021 - 10 comments

Wayland Games commented on Nov 15, 2021

Have a test dashboard app with two dashboards. Have created a Permission object which has a method of 'beExecutive' which checks whether the user has the exec role. Within the dashboard app this is called using enabledWhen.

If the currently logged in user has the exec role, the reports present correctly.

If however the currently logged in user does not have the exec role the expected behaviour of the dashboard app showing the unsecured dashboard in isolation is not occurring and the application is erroring out with:

Exception: Call undefined getEnabledDashboards() method in /var/www/html/waylandbi/vendor/koolreport/dashboard/TMagicMethod.php:23

I've clearly overlooked something somewhere but I'm not sure where. Any assistance greatly appreciated.

Wayland Games commented on Nov 16, 2021

Alternatively could someone advise how we get support? Have bought a licence, no response here or to that email.

KoolReport commented on Nov 16, 2021

You will get the support here. Sorry for our late reply, actually I have seen your post but forwarded to dev.team for consulting to provide exact response. I will come back to you shortly.

KoolReport commented on Nov 16, 2021

May I know if in your array in dashboards(), there is other class rather than Dashboard, Group and Section? If possible, please send me some of your code to analyze. You can send to support@koolreport.com if you want to be private.

Wayland Games commented on Nov 16, 2021

Thanks for the response! Have mailed the application over to the support address. Many thanks.

KoolReport commented on Nov 16, 2021

I got it. Could you please also send me the full error ( please expand[+] detail so that I see the traces ). It will help us very much to know where went wrong. Thank you very much.

Wayland Games commented on Nov 16, 2021

Have sent that along.

KoolReport commented on Nov 16, 2021

Thank you very much, I have forwarded information to dev.team to test. I will come back to you very soon.

KoolReport commented on Nov 16, 2021

Could you please help me one thing, please locate the file "vendor/koolreport/dashboard/pages/Main.php". Find the method getEnabledDashboards($menu) in line 79 and replace the whole function with this new one below:

    protected function getEnabledDashboards($menu)
    {
        $list = [];

        foreach ($menu as $item) {
            if($item->enabled()) {
                if ($item instanceof Dashboard) {
                    array_push($list, $item);
                } else {
                    $list = array_merge($list, $item->getEnabledDashboards());
                }
            }
        }
        return $list;
    }

And run the application again, please let me know if it works. It seems to be a bug there. we will update the new version tomorrow if confirmed.

Thank you very much.

Wayland Games commented on Nov 16, 2021

Thank you very much!

Can confirm that has resolved the problem and that the two dashboards render for the suitably authorised user and one dashboard renders without error for the restricted user. So that now works as expected.

Thanks again!

KoolReport commented on Nov 16, 2021

You are welcome :) Thank you very much for letting us know the issue.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

Dashboard