New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[11.0] website menu permission easy maintain #658
[11.0] website menu permission easy maintain #658
Conversation
looks good, and when you've changed the tests I think it will be green too. Let's then finally merge a version of this, the 8 and 10 version is hanging around like forever already |
For some reason travis cannot setup database connection:
|
you need to update this branch's .travis.yml. Best adapt to the current version in MQT - the crucial part here is to set a postgres version |
89bc6fc
to
7777985
Compare
|
||
#. Go to Website ==> Configuration ==> Website menu's. | ||
#. Edit the menu that you want to limit to certain groups, and add | ||
the names of the groups that should have access. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explanation is confusing because:
- In Website -> Configuration there are 2 different menu entries for the same model website.menu
- You need developer mode in order to see "Website menu's" entry. The other entry "Menu" you can see without developer mode.
I think is enough one menu entry and not two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only have one menu entry for website menu's. And I am in developer mode. If you see a second option for website menu's can you check from what module that is installed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's runbot installing all modules from the repository. I see xmlid website_multi_theme.action_configure_menu_website
7777985
to
5377b63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NL66278 @gfcapalbo thanks for taking care of this :)
Mostly ok, just some small things :)
|
||
class TestMenuPerm(test_common.TransactionCase): | ||
|
||
def setUp(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use SavepointCase and move setUp
to setUpClass
and replace the env like this:
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True, no_reset_password=True))
It's going to speed up tests a lot (actually we should use this approach for all tests 👨🏫 )
<record id="website_menu_access" model="ir.rule"> | ||
<field name="name">website_menu_permission group access</field> | ||
<field name="model_id" ref="model_website_menu"/> | ||
<field name="domain_force">['|',('group_ids','in', [g.id for g in user.groups_id]), ('group_ids','=',False)]</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one can use user.groups_id.ids
instead of the loop
@simahawk Changes done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG, can we squash?
This PR has the |
1. Prevent just installing this module of making most menu's unavailable for logged in users; 2. Make menu's directly configurable from website settings, as not all menu's are linked to a page; 3. Use group_ids field in new website.menu form to edit groups. With this commit, just installing this module will not change anything in existing permissions. TODO: update tests and README.rst.
a2f2cb8
to
e4404f3
Compare
@simahawk I squashed my commits, so that leaves 2. |
@rafaelbn fine for you? |
@simahawk I think the module website_menu_by_user_status does not add really anything, that cannot be done with website_menu_permission. But for some people it might be easier to just have the choice betwee users that are logged in or not. So I think the ..user_status module could be rebased om --.permission, doing away with any overlaps. But that can be done/proposed after the current PR has been merged. |
@NL66278 yeah, that was the original plan, also to keep backward compat: *_status module should rely on this one and just have a flag that sets the groups automatically. |
/ocabot merge |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at 35fd790. Thanks a lot for contributing to OCA. ❤️ |
This consists of two parts.
The record-rule itself remains the same. Basically as also in the PR made for 8.0 by @hbrunn for this purpose.