change modules's menu asssignment from "all" to "only selected" (even if all menuitems are checked).
should work the same way as with menu asssignment to "all" menu-items
call of ajax.php "$moduleObject = JModuleHelper::getModule('mod_' . $module, null);" returns Module id="0" (means module has not been found) and casts error404 with meessage:
LogicException: Module _ mod_modname is not published, you do not have access to it, or it's not assigned to the current menu item"_
checking module's authority, enablement or menu-assignment with JModuleHelper::getModule will not work and is not the correct way for module checking via ajax-interface. It should be done in other ways (e.g. like requiring a module-id in ajax-request additionally to the module-name an then do checking with modules table and module-menu-table)
Note that if no check is done at all - request will fail anyway later, if access to module is restricted or module is not published.
What do you mean with Itemid (do you mean menu-itemid?) - this is not documented at all - where would the module developer get the Itemid from?
In Joomla, any URL request should contain an Itemid (the menu item). Otherwise you get unexpected results like what you described.
Usually. JRoute::_()
takes care of that by using the active Itemid if none is specified. In case of your AJAX URL, you probably don't use SEF URLs (because they don't make sense there), and thus don't use JRoute::_(). So you have to add the active Itemid yourself to the request.
checked this - and this fixed it (added code to my module to provide "Itemid" of active menu). Nevertheless this has not been documented with com_ajax but should as this is very important for developers.
I think com_ajax must work without itemid, as it do not pass any parameters to the module helper,
so I would count it as
The docs.joomla.org web site is open for anyone to add/edit documentation -
it would be really helpful for others if you would add your findings and
advice to the docs
On 30 January 2015 at 10:36, Fedir Zinchuk notifications@github.com wrote:
I think com_ajax must work without itemid, as it do not pass any
parameters to the module helper—
Reply to this email directly or view it on GitHub
#5930 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
In the past was suggestion do check "whether module available" independant from Itemid https://github.com/joomla/joomla-cms/pull/3071/files#diff-4de1edbd5685ce87aa27e65ebca2b92bR89
I think com_ajax must work without itemid, as it do not pass any parameters to the module helper
com_ajax itself works fine without Itemid, as long as you don't make any requests which need one
Accessing a module is one of those cases where Joomla needs an Itemid to see if the module is available.
Imagine if you didn't make that check, then everyone could access the AJAX method even if the module is restricted to a specific usergroup or disabled. That opens the door for quite a few possible security issues.
Nevertheless this has not been documented with com_ajax but should as this is very important for developers.
It's not specific to com_ajax. It's a general rule that every request to Joomla has to contain an Itemid. Either explicit (by adding &Itemid=123
) or implicit (using a SEF URL with a menu alias). No exceptions.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-01-30 11:33:30 |
Labels |
Added:
?
|
Did you try passing an Itemid to the AJAX request URL?
@betweenbrain can you look into that?