Skip to main content
Topic: Role Based Access Control Error Executing Query Modifying Roles Table Key Column (Read 579 times) previous topic - next topic

Role Based Access Control Error Executing Query Modifying Roles Table Key Column

I am attempting to implement Role-Based Access Controls and get the following error when I click "Okay" on the "Role Base Access Control > Dynamic Role Permissions > Manage user Roles Permission Tables" dialog.

Quote
Error Executing Query :- 'ALTER TABLE `roles` MODIFY COLUMN `roleId` VARCHAR(255) auto_increment; ALTER TABLE `roles` MODIFY COLUMN `roleId` INTEGER(11); ALTER TABLE `role_permissions` MODIFY COLUMN `roleId` INTEGER(11); ALTER TABLE `staff` MODIFY COLUMN `Roles_roleId` INTEGER(11); ALTER TABLE `roles` ADD UNIQUE( `roleId`);'
Error message: Incorrect column specifier for column `roleId`

I believe the error is related to the ALTER TABLE `roles` MODIFY COLUMN `roleId` VARCHAR(255) auto_increment; statement.

I have an image but the upload directory is still full.


Re: Role Based Access Control Error Executing Query Modifying Roles Table Key Column

Reply #2
@willvin What do you want an image of? I manually typed in the error message since I couldn't upload an image here. An image will show you the same error:

Quote
Error Executing Query :- 'ALTER TABLE `roles` MODIFY COLUMN `roleId` VARCHAR(255) auto_increment; ALTER TABLE `roles` MODIFY COLUMN `roleId` INTEGER(11); ALTER TABLE `role_permissions` MODIFY COLUMN `roleId` INTEGER(11); ALTER TABLE `staff` MODIFY COLUMN `Roles_roleId` INTEGER(11); ALTER TABLE `roles` ADD UNIQUE( `roleId`);'
Error message: Incorrect column specifier for column `roleId`

Re: Role Based Access Control Error Executing Query Modifying Roles Table Key Column

Reply #3
Hi!

This is the (almost) same message I get when enabling dynamic roles - I posted the question/issue in another post.

When you enable the dynamic role PHPRAD always wants to modify the table structure even if its already prepared as it should be, and it is doing it in a strange way so the generated query results in an error and nothing gets changed/saved to the DB and the role thing does not get activated.

With the 2.7.3 version its happening always, on a new/blank database, just try to enable dynamic roles. I tried a few different "ways" of activating it (create tables, with fields, without fields...) but the end result is always the same - invalid query and the roles does not work (at least for me).

Re: Role Based Access Control Error Executing Query Modifying Roles Table Key Column

Reply #4
@mculibrk‍ please delete your roles and permissions table, then click on Roles and Permission on the PHPRad GUI, select Dynamic Role Permission then click on Manage Tables, after that click okay on the Manage Table panel, then click Okay on the Roles and Permission panel. This should generate the roles and permissions table with no errors.