Repository navigation
Propose using role-based menu system only #1052
Replies: 3 comments 7 replies
I really like this idea. Having the module flags in WWW_Users is inconsistent. In #352 I proposed to have it linked to user roles, but your idea is better. Being dynamic (if user can use a menu inside the module, then the module link should be shown to the user) solves config issues when creating a new user (or role).
I don't understand this. User A belongs to role X (www_users table). Role X has access to security token T. Script S has security token T. Then user has access to script S. Script S belongs to module M (as per menuitems table). Then user A has access to module M. I don't see why we need any change in WWWW_Access.php.
This is a desirable improvement, IMO. Why show a module link if there is nothing the user can do with it? R |
|
My understanding is that:
So we can know the modules that should be allowed for a user U dinamically, and get rid of the www_users.modulesallowed. should do the trick ;-), so we don't need to manually assign manually modules to users nor user roles. R |
|
I haven't fully considered is there is any relationship between the menu system and a finer-grained script security system (#1039), but I'm assuming the two are independent. |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Continuing from #1042 (Main menu does not render for a new user assigned a newly created role) and earlier #352 (Usage of secroleid in menuitems table), and facing a missing role-module management script but not being sure of its necessary functionality, I decided to try using role-based menu module visibility only and removed the per-user display controls ("ModulesEnabled / modulesallowed").
For me, the purpose, scope and overlap of the two methods of controlling the user menu was confusing and I wanted to try simplifying it with one method going forward for the benefit of both users and developers. This implementation also seems to agree with the proposals from @pakricard and agreement by @timschofield in #352.
Taking user role menu control out of the user record and controlling the menu based only on user role simplifies configuring a user. A module is only listed in the left vertical menu list if the user is assigned a token for at least one menu item in the module.
I am proposing this because it also simplifes the second-level menu visibility filter and implementation in SelectProduct.php, SelectSupplier.php and SelectCustomer.php that we have been discussing in #1038 (and would be available in includes/MiscFunctions.php for any other scripts to use which similarily provide menus of secondary scripts).
There will still need to be changes to the User Roles Maintenance script WWW_Access.php to associate a new role being created with associated modules in one step, avoiding the need for custom update scripts in the future. Also a new new Setup or Utilities script will be needed to populate menu items for the modules associated with the new user role.
Iiuc, using the role-based menu system will allow creating a completely ad hoc module and menu system for an arbitrary user role. This would require changes to the Menu Editor script MenuEditor.php, but I think the schema requirements are already be met.
To me, the user and developer simplification and reduced menu system code footprint benefits are more than enough to justify users having to migrate, especially as the migration procedure is relatively simple. What does everyone think? Is this something we can adopt?
You can see the changes in my "mainnew" branch https://github.com/dalers/webERP/tree/mainnew (see commit dalers@1bbbe9e, the branch has been updated since with the latest upstream project master branch commits).
I'm not sure if there is benefit to submitting the two test files.
Migrating an existing databases would involve:
This may result in modules that were formally visible "dissapearing" from the menu if the user does not have a security token for any menu item in that module, but given the user doesn't have a security token for any of the menu items anyway, this would seem to be an improvement resulting in more consistent webERP behavior (but I haven't inspected the logic well enough though to say if this is even a possibility).
All reactions