Jump to content

The slug ROLE_MOD_TAB__READ is invalid [Exception 0]


kostek.162

Recommended Posts

When I wan to see AdminStats module in this case Users Online on Admin page I get:

The slug ROLE_MOD_TAB__READ is invalid  [Exception 0]

It is thrown in Access.php in line 74:

    public static function isGranted($role, $idProfile)
    {
        foreach ((array) $role as $currentRole) {
            preg_match(
                '/ROLE_MOD_(?P<type>[A-Z]+)_(?P<name>[A-Z0-9_]+)_(?P<auth>[A-Z]+)/',
                $currentRole,
                $matches
            );

            if (isset($matches['type']) && $matches['type'] == 'TAB') {
                $joinTable = _DB_PREFIX_ . 'access';
            } elseif (isset($matches['type']) && $matches['type'] == 'MODULE') {
                $joinTable = _DB_PREFIX_ . 'module_access';
            } else {
                throw new Exception('The slug ' . $currentRole . ' is invalid');
            }

            $currentRole = Db::getInstance()->escape($currentRole);

            $isCurrentGranted = (bool) Db::getInstance()->getRow('
                SELECT t.`id_authorization_role`
                FROM `' . _DB_PREFIX_ . 'authorization_role` t
                LEFT JOIN ' . $joinTable . ' j
                ON j.`id_authorization_role` = t.`id_authorization_role`
                WHERE `slug` = "' . $currentRole . '"
                AND j.`id_profile` = "' . (int) $idProfile . '"
            ');

            if (!$isCurrentGranted) {
                return false;
            }
        }

        return true;
    }

 

When I comment out all function body and leave only return true, it starts working. But it;s only temporay solution I guess. Any sugestions?

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...