phaidon / Wikula

Wiki module for Zikula
5 stars 1 forks source link

Cannot edit a page #67

Closed hvorragend closed 12 years ago

hvorragend commented 12 years ago

I tried to edit a page and just see an error:

URL: http://domain.de/wikula/edit/tag/HomePage

Error

Access denied (error 403)

Sorry! You don't have authorisation for the page you wanted.
Additional information

    Could not load the 'wikula' module at 'edit'.
    Sorry! You have not been granted access to this page.

I am an administrator. .-)

phaidon commented 12 years ago

Does this bug just happen with the edit function or also with other pages?

hvorragend commented 12 years ago

Only the edit function is affected.

phaidon commented 12 years ago

I can not reproduce this problem. Here some test:

a. Comment the following lines lib/Wikula/Hanlder: // Permission check if (!ModUtil::apiFunc($this->name, 'Permission', 'canEdit', $this->_tag)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } Does it work now?

b. Changes this lines to // Permission check if (!SecurityUtil::checkPermission('Wikula::', '::', ACCESS_COMMENT)) { return LogUtil::registerPermissionError(); } Does this work?

Thank you for testing.

hvorragend commented 12 years ago

I think that this is more a shorturl related bug:

phaidon commented 12 years ago

I can not reproduce it with shorturls, too.

hvorragend commented 12 years ago

I think I've found it. Same problem as before in the breadcrumbs plugin here: https://github.com/phaidon/Wikula/commit/ba7b80265b9f66a61dff72b2083d9af5427b8589

$this->name is not always 'Wikula'

    function initialize(Zikula_Form_View $view)
    {
        $this->_tag = FormUtil::getPassedValue('tag', null, "GET", FILTER_SANITIZE_STRING);   

        // Permission check
        if (!ModUtil::apiFunc($this->name, 'Permission', 'canEdit', $this->_tag)) {
            throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
        }

If I replace $this->name with 'Wikula', then it works fine.

phaidon commented 12 years ago

Is that a Zikula core bug?

If I call $this->name in API functions the name of the API module will shown. If I call $this->name in handlers the name of the calling module will shown.

If it's not a bug we should replace all $this->name in handlers.

But anyway this should not affect your case, because in this case the caller module is also Wikula. Can you print $this->name and check what it is? Empty?

hvorragend commented 12 years ago

No, it was the "News" module. But only if shorturls are enabled.

phaidon commented 12 years ago

I still can not reproduce it. I tried with shorturls and a news block, but there was no error. But anyway I think we know what is the problem. I will replace all $this->name in the non admin handler as workround. We can revert it as soon as the zikula core bug is solved.

phaidon commented 12 years ago

Is the problem solved now?

hvorragend commented 12 years ago

Fixed

matheo commented 12 years ago

@hvorragend Carsten, we need to track down what's the shortURLs issue.

I cannot reproduce it either, so, you may need to tell us your Settings details, to revert the patch https://github.com/zikula/core/issues/161, and to disable your blocks/modules one by one until you get the correct $this->name

hvorragend commented 12 years ago

I've temporary opened this ticket again.

@matheo

Just try the following code:

File: src\modules\Wikula\lib\Wikula\Handler\EditTag.php

    /**
     * Setup form.
     *
     * @param Zikula_Form_View $view Current Zikula_Form_View instance.
     *
     * @return boolean
     */
    function initialize(Zikula_Form_View $view)
    {
        $this->tag = FormUtil::getPassedValue('tag', null, "GET", FILTER_SANITIZE_STRING);

        // Permission check
        print_r($this->name);
        die();
        if (!ModUtil::apiFunc($this->name, 'Permission', 'canEdit', $this->tag)) {
            throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
        }

If you know want to edit the homepage (URL: http://domain.de/wikula/edit/tag/HomePage) with shorturls enabled, then you see the wrong modname printed.

print_r($this->name); should be Wikula, but it is News

hvorragend commented 12 years ago

My settings:

All blocks are disabled.

matheo commented 12 years ago

Your homepage module is News? I was expecting News to be your default shortURL module, but you have it disabled? huh

I will need to access your machine to debug it in detail, and track the origin of that. Contact me please ;-)