Skip to content

Magento\Backend\App\AbstractAction::_isAllowed() should use a static binding #2361

@brideo

Description

@brideo

http://php.net/manual/en/language.oop5.late-static-bindings.php

Rather than this:

/**
 * @return bool
 */
protected function _isAllowed()
{
    return $this->_authorization->isAllowed(self::ADMIN_RESOURCE);
}

We should have this:

/**
 * @return bool
 */
protected function _isAllowed()
{
    return $this->_authorization->isAllowed(static::ADMIN_RESOURCE);
}

By using a static binding, we don't have to completely re-write the _isAllowed method in our controller action, instead we can simply define our ADMIN_RESOURCE constant, we then can let the AbstractAction handle our logic.

This would be a completely backwards compatible change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions