【问题标题】:How to protect view in Joomla 3.0如何在 Joomla 3.0 中保护视图
【发布时间】:2013-05-22 13:02:43
【问题描述】:

在 Joomla 3.0 中,基于 id 保护视图的最佳方法是什么。例如我有一个像这样的网址:

/administrator/index.php?option=com_helloworld&view=unitversions&layout=edit&id=158733

如果用户不“拥有”该 ID,我不希望他们能够看到此页面。我了解控制器将根据 ACL 进行授权,但只是重定向到与上述类似的 URL。

我认为插件可能是最好的方法?也许使用 onContentBeforeDisplay 触发器。

有人有更好的建议吗?

谢谢!

【问题讨论】:

    标签: joomla


    【解决方案1】:

    我认为这可能是 CMS 核心文件中的最佳方式。

        // Check for edit form.
        if ($vName == 'category' && $lName == 'edit' && !$this->checkEditId('com_categories.edit.category', $id))
        {
            // Somehow the person just went to the form - we don't allow that.
            $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
            $this->setMessage($this->getError(), 'error');
            $this->setRedirect(JRoute::_('index.php?option=com_categories&view=categories&extension='.$this->extension, false));
    
            return false;
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-10
      • 2012-02-20
      • 2013-02-05
      • 2012-07-14
      • 1970-01-01
      相关资源
      最近更新 更多