Using rights extension with different table and column name

Once you have installed and configured the rights extension in your application, you can change the table name from 'User' to any table name you want and similarly for 'username' column to any other column name.

Let say, we have table named 'Employee' with fields (id, name, email,...) and we want to use 'Employee' table name instead of 'User', 'email' column instead of 'username'.

To do so:

  • First goto the main.php and add the following
'modules' => array(
        ...
        'rights' => array(
            'install' => false,
            'userClass' => 'Employee',
            'userNameColumn' => 'email',
        ),
        ...
    ),
  • Secondly, goto to the /modules/rights/components/RAuthorizer.php and change the following code at line # 300
$superusers[] = $user->name;

with

$superusers[] = $user->email;

By doing so, the rights extension will starting using 'Employee' table instead of 'User' and 'email' fields instead of 'username'.