Pending

User tests: Successful: Unsuccessful:

avatar rmcdaniel
rmcdaniel
21 May 2012

This adds ACL to the menu manager. Most of the code was copied from the content manager. I tried to follow all the conventions in the original code. I hope this helps!

avatar rmcdaniel rmcdaniel - open - 21 May 2012
avatar realityking
realityking - comment - 21 May 2012

Haven't tested it yet but the idea is awesome!

Note: We'll have to update the sample data after this has landed.

avatar rmcdaniel
rmcdaniel - comment - 21 May 2012

I forgot something else. In order to install properly, in installation/sql/mysql/joomla.sql this line:

INSERT INTO #__menu_types VALUES (1, 'mainmenu', 'Main Menu', 'The main menu for the site');

should be:

INSERT INTO #__menu_types VALUES (1, 0, 'mainmenu', 'Main Menu', 'The main menu for the site');

How do I add this to the pull request? Or should I make a new one?

avatar realityking
realityking - comment - 21 May 2012

You can just add another commit to your branch, it will automatically be part of the pull request.

Another note that just occured to me: We probably need a migration script for this. I'm pretty sure something weird will happen if there isn't an entry in the asset table for a menu or menu item.

avatar rmcdaniel
rmcdaniel - comment - 21 May 2012

Thanks for the help.

Regarding the migration script, when I was working on this, I started by just doing ALTER TABLE to add the asset_id column. Everything defaulted to 0 asset_id and nothing blew up. That might be enough.

avatar infograf768
infograf768 - comment - 22 May 2012

Created an update sql file containing
ALTER TABLE #__menu_types ADD COLUMN asset_id INTEGER UNSIGNED NOT NULL DEFAULT '0' COMMENT 'FK to the #assets table.' AFTER id;
ALTER TABLE `#
menuADD COLUMNasset_idINTEGER UNSIGNED NOT NULL DEFAULT '0' COMMENT 'FK to the #__assets table.' AFTERid`;

Ran it and then tested on existing site

saw some errors preventing the tmpl from displaying wen editing a menu item

$canDo = $this->canDo; // error
$canDoAlso = $this->canDoAlso; //error

Also some errors with divs in views/item/tmpl/edit.php

avatar rmcdaniel
rmcdaniel - comment - 22 May 2012

Alright, this latest commit should fix the problems that infograf768 saw.

avatar infograf768
infograf768 - comment - 23 May 2012

The above errors are now corrected.
@test
Default Administrator has no access to menus/menu items permissions.

avatar rmcdaniel
rmcdaniel - comment - 23 May 2012

I fixed the permissions for new installations. For current installations you need to execute:

UPDATE #__assets SET rules = '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}' WHERE id = 16;

avatar infograf768
infograf768 - comment - 24 May 2012

@ test
This does not work here.

avatar rmcdaniel
rmcdaniel - comment - 24 May 2012

The only thing I can think of is that maybe the group and/or asset ids are different on your dataset.

avatar infograf768
infograf768 - comment - 25 May 2012

I am using default trunk install with sampledata, patched with your diff and both queries.
I suggest you test this environment

avatar sanderpotjer
sanderpotjer - comment - 31 May 2012

@rmcdaniel great idea to add ACL support to menu's! Much requested feature among the users of Joomla ACL.

Just started testing this new feature, and during the installation of fresh site with sampledata errors are visible while installing sampledata. The reason for this is that for example "installation/sql/mysql/sample_data.sq" should be updates as well with asset_id values for the #menu and #menu_types. Same for any other sample data file. In addition to this there should be references for all menu items and menus in the #__assets table as well.

avatar infograf768
infograf768 - comment - 31 May 2012

@sanderpotjer
Indeed. This is what I tried to convey above. If we want to implemnt this for 3.x, we will not only have to change sampledatas, but also provide a migration for existing sites.

avatar rmcdaniel
rmcdaniel - comment - 31 May 2012

Thanks for the information. I'll try to get the sample data and the assets done today. As for the migration script, can you give me any ideas on how to start? Is there an example in the installation folder already? Any documentation? Another thing that someone with more experience could look at is how I implemented _getAssetParentId(). I think it might be supposed to return the menutype id, or maybe it should return the parent menu item if that exists?

avatar infograf768
infograf768 - comment - 31 May 2012

We do not have any migration script in present trunk. Just some simple updates to the db in com_admin.

avatar sanderpotjer
sanderpotjer - comment - 31 May 2012

Actually, the core.edit.own action is not needed in this component at the moment. There is no information stored in the menu tables about the creators of menutypes/menus. So it is better to remove the entire core.edit.own action for this component or we need to extend the menu tables with the creator information.

avatar rmcdaniel
rmcdaniel - comment - 31 May 2012

Does that mean I should remove it from the menu section as well?

avatar sanderpotjer
sanderpotjer - comment - 31 May 2012

@rmcdaniel yes that is correct to remove core.edit.own from the menu section as well. Sorry for the confusing btw, just noticed edit.own isn't possible at the moment, so better to remove it for now.

avatar sanderpotjer
sanderpotjer - comment - 31 May 2012

Another thing I noticed, when installing new components an entry in the #__menu table is created for each of the backend menu items of the component (this is currently default in Joomla). Now with this new menu ACL an entry in the assets table is created as well, but missing the correct parent and level id's. This is more difficult to fix because there is no 'menutype' for the backend menu items.

This might be solved if the backend menu will be transformed in a similar system as the frontend menus. I know there are plans for that, but don't know the status of that. So need to look into this (but want to share it already).

avatar elinw
elinw - comment - 1 Jun 2012

In what sense is there ownership in menus?
the edit.own management is very messy to start out with since it violates a number of principles of ACL. There were very good reasons it was decided not to implement it below the category level for anything but articles in 1.6+.

You need to look at com_categories as that is the only core component that has a table extending jtablenested. That should show you how to work with nesting correctly.

avatar rmcdaniel
rmcdaniel - comment - 11 Jul 2012

We'd really like to see this in Joomla 3.0 if not sooner. Please advise on what needs to be done in order to keep this alive. I've seen a lot of support for the idea so far.

avatar klah
klah - comment - 2 Oct 2012

Is there any news on whether this will be included in a future Joomla version?

Also (to me) the menu item management option doesn't seem to be working. I set the permissions of a menu item for Manager to Denied for all the actions. But a manager can still happily open, edit and save the item. He can even change his own permissions.

avatar elinw
elinw - comment - 3 Oct 2012

1,2,3,4,5,6,7,8,9,10

As always the only "news" that matters is that from people who have tested
and done code review and placed those comments in the feature tracker. So
I am assuming you have done that?

Elin

On Tue, Oct 2, 2012 at 5:35 AM, klah notifications@github.com wrote:

Is there any news on whether this will be included in a future Joomla
version?


Reply to this email directly or view it on GitHub#212 (comment).

avatar rmcdaniel rmcdaniel - close - 19 Jul 2013
avatar coolbung coolbung - reference | 7b1a1e3 - 14 Sep 13

Add a Comment

Login with GitHub to post a comment