aspose file tools*
The moose likes JForum and the fly likes no user with admin permissions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JForum
Bookmark "no user with admin permissions" Watch "no user with admin permissions" New topic
Author

no user with admin permissions

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi,

somehow i managed to remove the admin permissions from both my account with rights for the admin control panel.
Is there any way to create a new admin user in the database, or give an existing user admin rights without access to the admin pages?

kind regards,
Rene Boere
[originally posted on jforum.net by rboere]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
You can do this via direct access to your database. E.g., via MySQL's admin GUI or command line tool. There are two common ways that admin rights can be lost:

First, the administration group might have had the admin permissions dropped from it. To check if this is the case, use this query:

select * from jforum_roles where name = 'perm_administration'

There should be at least one group_id with this permission.

If this isn't the case, do the following:

Find the group id of the administration group with:

select group_id from jforum_groups where group_name = 'Administration'

Then add back in the admin permission with:

INSERT INTO jforum_roles (group_id, name) VALUES (<ADMIN_GROUP_ID>, 'perm_administration');

Replace the <ADMIN_GROUP_ID with your group id. >


====
The next possible problem could be that the admin user has been removed from the Administration group. To fix this do the following:

Find the user id (number) of the user you want to be the administrator with a query like:

select user_id from jforum_users where username = 'admin'

replace admin with a different one if desired). Write down the number returned.

Next get the group_id number of the Administration group with the query:

select group_id from jforum_groups where group_name = 'Administration'

Finally, add the user back into the administration group with:

insert into jforum_user_groups ( group_id, user_id) values ( <admin group id>, <admin user id> )

Replace the <..> items in the values part with the numbers from the first two queries.

Note, if you don't find the Administration group, it might have been deleted. A quick way to get around this is to grant admin rights to an existing group. Recreate the administration group with admin rights and correct membership, and then remove admin rights from the other group.



[originally posted on jforum.net by monroe]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: no user with admin permissions