Root Admin role can be duplicated #188

Closed
opened 2026-02-04 17:01:12 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @HirziDevs on GitHub (Oct 28, 2024).

Originally assigned to: @Boy132 on GitHub.

Current Behavior

Creating an administrator user using the command php artisan p:user:make will create another Root Admin role in the panel.

  • Original Root Admin role

    Original Root Admin role

  • Duplicated Root Admin Role

    Duplicated Root Admin Role

Panel roles

The duplicated Root Admin role can be assigned to users, unlike the original Root Admin role.

Duplicated Root Admin role can be s<br>
assigned fo users

Expected Behavior

It should use the existing Root Admin role instead of creating a new one.

Steps to Reproduce

  • Run php artisan p:user:make in the /var/www/pelican directory
  • Assign the user as an administrator
  • Complete the user creation process

Panel Version

v1.0.0-beta11

Wings Version

v1.0.0-beta6

Games and/or Eggs Affected

No response

Docker Image

No response

Error Logs

No response

Is there an existing issue for this?

  • I have searched the existing issues before opening this issue.
  • I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
  • I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.
Originally created by @HirziDevs on GitHub (Oct 28, 2024). Originally assigned to: @Boy132 on GitHub. ### Current Behavior Creating an administrator user using the command `php artisan p:user:make` will create another Root Admin role in the panel. - Original Root Admin role ![Original Root Admin role](https://github.com/user-attachments/assets/5530d01d-6d85-4118-846a-e107975f85dc) - Duplicated Root Admin Role ![Duplicated Root Admin Role](https://github.com/user-attachments/assets/5abde000-8c96-4ad4-955a-b2a3c043a0a5) ![Panel roles](https://github.com/user-attachments/assets/14c4f5cd-74ea-4fba-ba71-036f31627f1c) The duplicated Root Admin role can be assigned to users, unlike the original Root Admin role. ![Duplicated Root Admin role can be s assigned fo users](https://github.com/user-attachments/assets/0f41c49e-4532-4ce1-9361-de921f203192) ### Expected Behavior It should use the existing Root Admin role instead of creating a new one. ### Steps to Reproduce - Run `php artisan p:user:make` in the `/var/www/pelican` directory - Assign the user as an administrator - Complete the user creation process ### Panel Version v1.0.0-beta11 ### Wings Version v1.0.0-beta6 ### Games and/or Eggs Affected _No response_ ### Docker Image _No response_ ### Error Logs _No response_ ### Is there an existing issue for this? - [X] I have searched the existing issues before opening this issue. - [X] I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server. - [X] I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.
OVERLORD added the 🟢 easy label 2026-02-04 17:01:12 +03:00
Author
Owner

@rmartinoscar commented on GitHub (Oct 28, 2024):

Couldn't reproduce

@rmartinoscar commented on GitHub (Oct 28, 2024): Couldn't reproduce
Author
Owner

@HirziDevs commented on GitHub (Oct 29, 2024):

Couldn't reproduce

If I remember correctly, this happened when I was testing the API for roles and accidentally removed the original root admin role from my account. I had to create another admin account using php artisan p:user:make. After logging in with the new admin user, I noticed that there were two root admin roles.

@HirziDevs commented on GitHub (Oct 29, 2024): > Couldn't reproduce If I remember correctly, this happened when I was testing the API for roles and accidentally removed the original root admin role from my account. I had to create another admin account using `php artisan p:user:make`. After logging in with the new admin user, I noticed that there were two root admin roles.
Author
Owner

@Boy132 commented on GitHub (Oct 29, 2024):

@HirziDevs Could you check your database and see what value the guard_name column of the two root admin roles has?

@Boy132 commented on GitHub (Oct 29, 2024): @HirziDevs Could you check your database and see what value the `guard_name` column of the two root admin roles has?
Author
Owner

@HirziDevs commented on GitHub (Oct 29, 2024):

@HirziDevs Could you check your database and see what value the guard_name column of the two root admin roles has?

@Boy132 The guard_name is sanctum and the original is web

Root Admin guard_name

@HirziDevs commented on GitHub (Oct 29, 2024): > @HirziDevs Could you check your database and see what value the `guard_name` column of the two root admin roles has? @Boy132 The guard_name is `sanctum` and the original is `web` ![Root Admin guard_name](https://github.com/user-attachments/assets/f6201c8a-9476-4b9f-949f-6f2f3de6de80)
Author
Owner

@rmartinoscar commented on GitHub (Oct 29, 2024):

You can remove it via

DELETE FROM model_has_roles WHERE role_id IN (SELECT id FROM roles WHERE name = 'Root Admin' AND id <> 1);
DELETE FROM roles WHERE name = 'Root Admin' AND id <> 1;

This will unassign any duplicate role to every user and remove that said role.

If for whatever reason you want multiple users with rootadmin then use this instead:

UPDATE model_has_roles SET role_id=1 WHERE role_id IN (SELECT id FROM roles WHERE name = 'Root Admin' AND id <> 1);
DELETE FROM roles WHERE name = 'Root Admin' AND id <> 1;
@rmartinoscar commented on GitHub (Oct 29, 2024): You can remove it via ```sql DELETE FROM model_has_roles WHERE role_id IN (SELECT id FROM roles WHERE name = 'Root Admin' AND id <> 1); DELETE FROM roles WHERE name = 'Root Admin' AND id <> 1; ``` This will unassign any duplicate role to every user and remove that said role. If for whatever reason you want multiple users with rootadmin then use this instead: ```sql UPDATE model_has_roles SET role_id=1 WHERE role_id IN (SELECT id FROM roles WHERE name = 'Root Admin' AND id <> 1); DELETE FROM roles WHERE name = 'Root Admin' AND id <> 1; ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/panel#188