public function hasPermission($sSearch, $mUser = null)
    {
        //  Fetch the correct ACL
        if (is_numeric($mUser)) {

            $oUser = $this->getById($mUser);

            if (isset($oUser->acl)) {
                $aAcl = $oUser->acl;
                unset($oUser);
            } else {
                return false;
            }

        } elseif (isset($mUser->acl)) {
            $aAcl = $mUser->acl;
        } else {
            $aAcl = (array) $this->activeUser('acl');
        }

        // --------------------------------------------------------------------------

        // Super users or CLI users can do anything their heart desires
        $oInput = Factory::service('Input');
        if (in_array('admin:superuser', $aAcl) || $oInput::isCli()) {
            return true;
        }

        // --------------------------------------------------------------------------

        /**
         * Test the ACL
         * We're going to use regular expressions here so we can allow for some
         * flexibility in the search, i.e admin:* would return true if the user has
         * access to any of admin.
         */

        $bHasPermission = false;

        /**
         * Replace :* with :.* - this is a common mistake when using the permission
         * system (i.e., assuming that star on it's own will match)
         */

        $sSearch = strtolower(preg_replace('/:\*/', ':.*', $sSearch));

        foreach ($aAcl as $sPermission) {

            $sPattern = '/^' . $sSearch . '$/';
            $bMatch   = preg_match($sPattern, $sPermission);

            if ($bMatch) {
                $bHasPermission = true;
                break;
            }
        }

        return $bHasPermission;
    }