j2commerce / j2cart

J2Commerce - Open Source eCommerce extension for Joomla
https://www.j2commerce.com
GNU General Public License v3.0
9 stars 7 forks source link

Added test on user to determine if the module should show or not #67

Closed obuisard closed 10 hours ago

brianteeman commented 1 day ago

This is an admin menu module. How can there ever be a situation that a user is not logged in?

obuisard commented 1 day ago

It is to avoid this:

image

brianteeman commented 1 day ago

I thought that might be what you meant. Its not the correct solution and yes I see you did it this way the core guided yours module. ;)

A better way is to check if the user has permissions for j2store and only display the module then. thats how core should be doing it. something like

        if (
            !$this->getApplication()->getIdentity()->authorise('core.manage', 'com_j2store')
        ) {
            return;
        `}`
j2commerce commented 1 day ago

Ok, I understand, thanks Brian @brianteeman. It does also cover the case where someone should not have access to the module in the console, once logged in.

brianteeman commented 15 hours ago

@j2commerce perfect