SQL Script To Migrate Permissions

Tips submitted by PHPMaker users
Post Reply
Niijimasama
User
Posts: 85

SQL Script To Migrate Permissions

Post by Niijimasama »

If you are migrating your application from your development environment to production environment or any such move, the below script will help you achieve this without going to the interface to setup permissions again. (Tested on PHPMaker 2020 & 2021 all versions)

SELECT CONCAT('insert into userlevelpermissions(userlevelid,tablename,permission) values(',userlevelid,',"',tablename,'",', permission,');')perms
FROM userlevelpermissions
 WHERE SUBSTR(tablename,1,38) = 'PROJECT_ID'
 into outfile 'c:/tmp/permissions.txt '

This creates a text file in a given directory with insert scripts for all generated objects(Reports included) in your project
NOTES:

  1. Project ID can be found at Tools-> Advanced Settings -> Project ID
  2. Ensure SQL engine has read/write access to folder where file is to be created. For MariaDB and MySQL, the parameter to modify is secure_file_priv

Post Reply