• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Cannot remove User Role

Gerinho

New Pleskian
Hi Pleskians,

I have a small issue and I just can't work it out. I'm working with Plesk Onyx v17.8.11 and I'm the admin.

Process
I was testing using Customers by creating a Customer, then migrating some Subscriptions to this new made Subscriber. Then, under Users > User Roles, I've noticed Plesk created duplicates of the user roles that were assigned to these users when under the previous Subscriber.

For example: I had user 'test1' assigned to a user role named 'Admin', which after migration got assigned '[[Admin 1]]' - it's with these square brackets, which I found odd in first place, because the rest was without the square brackets.

Then I migrated these subscriptions back to their original Subscriber (which was just Administrator) and assigned them their original user roles back.

Problem
Now here's the thing: I'm able to remove al 'duplicate' User Roles, which were named 'Webmaster 1', 'Custom 1', etc. EXCEPT for this '[[Admin 1]]' user role. Plesk GUI says I can't remove this one because "This role is assigned to one or more user accounts." and disables the checkbox. However, at the right hand side of the table, it shows 0 users are assigned to this role. See at the red arrows here:

plesk-user-role-issue.png

I've tried various things after many hours of troubleshooting, but I just can't solve this one. How can I remove this user role?
 
Looks like database inconsistency. Try to fix it with

# plesk repair db

or directly in plesk database. Related tables:

Code:
MariaDB [psa]> show tables like "%role%";
+----------------------------+
| Tables_in_psa (%role%)     |
+----------------------------+
| smb_roleGeneralPermissions |
| smb_roleServicePermissions |
| smb_roles                  |
+----------------------------+
3 rows in set (0.00 sec)

Or contact Plesk Support Team if you are not familiar with SQL.
 
Thanks Igor, thanks to your suggestion I've found the user role in the 3 tables you mentioned;

in smb_roles:
Code:
MariaDB [psa]> select * from smb_roles;
+----+--------------+-----------+---------+----------------------+
| id | name         | isBuiltIn | ownerId | isActivationRequired |
+----+--------------+-----------+---------+----------------------+
|  1 | Admin        |         1 |       1 |                    0 |
|  2 | Webmaster    |         0 |       1 |                    0 |
|  3 | Service User |         0 |       1 |                    0 |
|  4 | Accountant   |         1 |       1 |                    0 |
| 16 | Admin 1      |         1 |       1 |                    0 |
+----+--------------+-----------+---------+----------------------+

in smb_roleGeneralPermissions:
Code:
MariaDB [psa]> select * from smb_roleGeneralPermissions;
+-----+--------+---------------------+-----------+
| id  | roleId | generalPermissionId | isAllowed |
+-----+--------+---------------------+-----------+
| 101 |      1 |                   1 |         1 |
| 102 |      1 |                   2 |         1 |
| 103 |      1 |                   3 |         1 |

[ ... ]

| 306 |     16 |                   1 |         1 |
| 307 |     16 |                   2 |         1 |
| 308 |     16 |                   3 |         1 |
| 309 |     16 |                   4 |         1 |
| 310 |     16 |                   5 |         1 |
| 311 |     16 |                   6 |         1 |
| 312 |     16 |                   7 |         1 |
| 313 |     16 |                   8 |         1 |
| 314 |     16 |                   9 |         1 |
| 315 |     16 |                  10 |         1 |
| 316 |     16 |                  11 |         1 |
| 317 |     16 |                  12 |         1 |
| 318 |     16 |                  13 |         1 |
| 319 |     16 |                  14 |         1 |
| 320 |     16 |                  15 |         1 |
| 321 |     16 |                  17 |         1 |
| 322 |     16 |                  18 |         1 |
+-----+--------+---------------------+-----------+

in smb_roleServicePermissions:
Code:
MariaDB [psa]> select * from smb_roleServicePermissions;
+----+--------+---------------------+
| id | roleId | servicePermissionId |
+----+--------+---------------------+
|  1 |      1 |                   1 |
|  2 |      2 |                   1 |
|  7 |     16 |                   1 |
+----+--------+---------------------+


Would it be safe to manually delete the rows where id=16 in smb_roles and where roleId=16 in the other two tables?
 
I would suggest you ask the assistance of Plesk Support Team regarding intervention in Plesk database.
Before this action you can try to remove this role in CLI with help of role utility:

# plesk bin role --help
 
Wish I could buy you a coffee and pizza right now, with your helpful guidance to the Plesk utility I've managed to remove the role.

The golden cmd:
Code:
plesk bin role -d Admin\ 1 -owner admin

For a moment I felt like a total noob though, because I couldn't find the role due to not escaping the space with the backslash..

Many thanks, it's solved now!
 
Back
Top