[英]Using Joomla 1.5 ACL for custom extension content - is this the right way?
我正在開發Joomla! 1.5擴展具有兩種類型的注冊用戶,每種用戶都可以訪問其特定內容。
我已經閱讀了很多有關使用Joomla ACL實現來實現這一目標的內容。 我了解它基於phpGACL。
如果我打算做的是正確的方法,我正在尋求任何指導或建議。
假設我的擴展名為“教室”。
假設我有用戶類型:“學生”和“老師”
兩者都是注冊用戶。
“學生”有權訪問“電子書”“教師”有權訪問“ classregister”
我假設我使用訪問擴展對象將擴展訪問控制對象。
$extACL = & JFactory::getACL();
//define permissions for teacher
$extACL->_mos_add_acl('com_classroom','accessdata','users','registered','usersection','classregister');
//define permissions for student
$extACL->_mos_add_acl('com_classroom','accessdata','users','registered','usersection','ebooks');
然后,根據需要,我可以使用以下方法檢查(例如)“電子書”區域的權限
//After checking if it is the right user
$user = & JFactory->getUser();
if(! $user->authorize('com_classroom','accessdata','usersection','ebooks'))
{
JError::raiseError('403',JText::_('You are not logged in as a student'));
}
我了解Joomla的正確用法! 我的擴展程序的ACL還是錯? 還是我必須定義自己的訪問控制。
希望我有道理。
謝謝你的時間!
我同意udjamaflip。 Joomla 1.5已過時,您正在尋找的內容可以在1.6和1.7中輕松完成。 為什么要重新發明輪子?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.