Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Bug Reports » subsystem export does not cover user roles
subsystem export does not cover user roles [message #5297] Sat, 16 January 2016 06:38 Go to next message
kong is currently offline  kong
Messages: 90
Registered: December 2011
Member
When exporting a menu subsystem the resulting "...menu_export.sql" file does not cover user roles used by the subsystem.
This is cumbersome especially for roles that are exclusive to such subsystem and need to be added manually when restoring subsystem to a new radicore db.
Not sure whether this is an oversight or perhaps purposely designed this way...
Re: subsystem export does not cover user roles [message #5299 is a reply to message #5297] Sun, 17 January 2016 04:36 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2371
Registered: April 2006
Location: Surrey, UK
Senior Member
The MNU_ROLE table does not belong to a particular subsystem, so it is only exported when the MENU subsystem itself is exported. The same is true for the MNU_LANGUAGE, MNU_PATTERN, MNU_TIME_LIMIT_ROLE, MNU_CONTROL, MNU_ACCOUNT, MNU_MOTD, MNU_USER, MNU_USER_ROLE, MNU_TODO, MNU_USER_IP_ADDRESS, MNU_FAVOURITE and MNU_TIME_LIMIT_USER tables.

If I included the MNU_ROLE table in the subsystem export it may include roles that have no contact with that subsystem. Is this what you want?


Re: subsystem export does not cover user roles [message #5301 is a reply to message #5299] Sun, 17 January 2016 23:54 Go to previous messageGo to next message
kong is currently offline  kong
Messages: 90
Registered: December 2011
Member
Definitely should not include anything that has no contact with the exported subsystem. So, only the roles directly referenced by the subsystem will be sufficient. To make this happen I added the following code to file mnu_subsystem_s01.class.inc, function _exportSQL:
        // export the contents of MNU_ROLE used by this subsystem
        $taskobj->sql_select = 'DISTINCT mnu_role.*';
        $taskobj->sql_from   = 'mnu_role '
     		.'INNER JOIN mnu_role_task ON mnu_role_task.role_id=mnu_role.role_id '
       		.'INNER JOIN mnu_task AS task ON task.task_id=mnu_role_task.task_id ';
        $taskobj->sql_orderby = 'role_id';
        $data = $taskobj->getData_raw("task.subsys_id='$subsys_id'");
        $output = $this->_exportSqlData('mnu_role', $data, $output);
As to why this treatment for MNU_ROLE and not the other tables you mentioned, the distinction is that its primary key role_id is directly referenced in "...menu_export.sql" while the others are not (unless exported subsystem is MENU itself).
Re: subsystem export does not cover user roles [message #5309 is a reply to message #5301] Mon, 18 January 2016 06:29 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2371
Registered: April 2006
Location: Surrey, UK
Senior Member
I have updated mnu_subsystem_s01.class.inc to do this, but with slightly different code. Let me know if it does what you want.

Re: subsystem export does not cover user roles [message #5326 is a reply to message #5309] Tue, 19 January 2016 08:02 Go to previous message
kong is currently offline  kong
Messages: 90
Registered: December 2011
Member
That works. Thanks!
Previous Topic: subsystem export does not cover menu tasks for roles' task access
Next Topic: Bug with 'require_once' file path
Goto Forum:
  


Current Time: Wed Dec 18 18:46:01 EST 2024

Total time taken to generate the page: 0.01160 seconds