Jump to content

Edit History

Tuni-Soft

Tuni-Soft

I solved it by modifying this method directly

 

// /src/Adapter/Module/AdminModuleDataProvider.php

public function isAllowedAccess($action, $name = '')
{
    if (Tools::isPHPCLI()) {
        return true;
    }

    if (in_array($action, ['install', 'upgrade'])) {
        return $this->employee->can('add', 'AdminModulessf');
    }

    if ('uninstall' === $action) {
        return $this->employee->can('delete', 'AdminModulessf') && $this->moduleProvider->can('uninstall', $name);
    }

    // add this statement
    if (in_array($action, array('enable', 'disable', 'enable_mobile', 'disable_mobile', 'reset'))) {
        return $this->employee->isSuperAdmin();
    }

    return $this->employee->can('edit', 'AdminModulessf') && $this->moduleProvider->can('configure', $name);
}

or like this

public function isAllowedAccess($action, $name = '')
{
    if (Tools::isPHPCLI()) {
        return true;
    }

    if (in_array($action, ['install', 'upgrade', 'enable', 'enable_mobile'])) {
        return $this->employee->can('add', 'AdminModulessf');
    }

    if (in_array($action, ['uninstall', 'reset', 'disable', 'disable_mobile'])) {
        return $this->employee->can('delete', 'AdminModulessf') && $this->moduleProvider->can('uninstall', $name);
    }

    return $this->employee->can('edit', 'AdminModulessf') && $this->moduleProvider->can('configure', $name);
}

 

Tuni-Soft

Tuni-Soft

I solved it by modifying this method directly

 

// /src/Adapter/Module/AdminModuleDataProvider.php

public function isAllowedAccess($action, $name = '')
{
    if (Tools::isPHPCLI()) {
        return true;
    }

    if (in_array($action, ['install', 'upgrade'])) {
        return $this->employee->can('add', 'AdminModulessf');
    }

    if ('uninstall' === $action) {
        return $this->employee->can('delete', 'AdminModulessf') && $this->moduleProvider->can('uninstall', $name);
    }

    // add this statement
    if (in_array($action, array('enable', 'disable', 'enable_mobile', 'disable_mobile', 'reset'))) {
        return $this->employee->isSuperAdmin();
    }

    return $this->employee->can('edit', 'AdminModulessf') && $this->moduleProvider->can('configure', $name);
}

 

×
×
  • Create New...