How to retrive the admin role

Author Message

Vincent Lyu

Tuesday 11 July 2006 11:15:17 pm

Unfortunately,i deleted the admin role by mistake,how could i retrive it?

Create New Web,Create New World!

Xavier Dutoit

Wednesday 12 July 2006 11:25:07 pm

Create a role that grant all on all modules on all methods.

At the end you have something like
* * *

And put a user under that role
X+

http://www.sydesy.com

Vincent Lyu

Thursday 13 July 2006 12:22:22 am

i'm afraid i can't login as admin or other users,so could you tell me how to find the entry using mysql and update a new role?

Lazaro Ferreira

Thursday 13 July 2006 2:28:21 am

Hi,

I guess you can logon to mysql then look at

ezuser 

and

ezuser_role

tables in another ezpublish setup of the same version, look for

admin

login there you can get the information to fix your tables

Lazaro
http://www.mzbusiness.com

Ɓukasz Serwatka

Thursday 13 July 2006 4:22:49 am

Run following SQL queires:

First create new role:
INSERT INTO ezrole (version, name, is_new) VALUES('0', 'New role', '1');

Check id of new created role and use in (new policy) second query (replace ROLE_ID, with correct integer):
INSERT INTO ezpolicy (role_id, module_name, function_name) VALUES('ROLE_ID', '*', '*')

As third query run, 12 is contentobject_id of administrators user group, replace ROLE_ID with your:
INSERT INTO ezuser_role (contentobject_id, id, limit_identifier, limit_value, role_id) VALUES('12', NULL, '', '', 'ROLE_ID')

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Vincent Lyu

Thursday 13 July 2006 7:56:46 am

mysql> select * from ezpolicy;
+---------------+-----+-------------+---------+
| function_name | id | module_name | role_id |
+---------------+-----+-------------+---------+
| * | 308 | * | 2 |
| read | 352 | content | 1 |
| pdf | 353 | content | 1 |
| edit | 354 | content | 1 |
| * | 355 | content | 11 |
| login | 356 | user | 11 |
| preferences | 357 | user | 11 |
| * | 358 | content | 3 |
| login | 359 | user | 3 |
| preferences | 360 | user | 3 |
| * | 361 | * | 13 |
+---------------+-----+-------------+---------+
11 rows in set (0.00 sec)

mysql> select * from ezuser;
+------------------+----------------------+-----------+----------------------------------+----
----------+
| contentobject_id | email | login | password_hash | pas
hash_type |
+------------------+----------------------+-----------+----------------------------------+----
----------+
| 10 | nospam@ez.no | anonymous | cba40278b4197a74eb91bc9feb6faba1 |
2 |
| 12 | jerkwolf@hotmail.com | admin | 5929d1915a73e7446079f69857f9d89e |
2 |
| 64 | flashwolf@126.com | jerkwolf | b0835d955b2eca5f617a2acb8a9d1015 |
2 |
| 98 | flashwolf@sina.com | flashwolf | a1b5b31ff95d8c728dbfe93553d4b6da |
2 |
| 99 | lvwenshi@hotmail.com | lvwenshi | 6d7cac8cb0f1db5ec0a19e5ce5da341a |
2 |
| 100 | | | |
1 |
+------------------+----------------------+-----------+----------------------------------+----
----------+
6 rows in set (0.00 sec)

mysql> select * from ezuser_role;
+------------------+----+------------------+-------------+---------+
| contentobject_id | id | limit_identifier | limit_value | role_id |
+------------------+----+------------------+-------------+---------+
| 12 | 25 | | | 2 |
| 11 | 28 | | | 1 |
| 42 | 31 | | | 1 |
| 11 | 35 | | | 3 |
| 42 | 36 | | | 3 |
| 12 | 37 | | | 13 |
+------------------+----+------------------+-------------+---------+
6 rows in set (0.00 sec)

mysql> select * from ezrole;
+----+--------+---------------+-------+---------+
| id | is_new | name | value | version |
+----+--------+---------------+-------+---------+
| 1 | 0 | Anonymous | | 0 |
| 2 | 0 | Administrator | * | 0 |
| 3 | 0 | Editor | | 0 |
| 13 | 1 | New role | NULL | 0 |
+----+--------+---------------+-------+---------+
5 rows in set (0.00 sec)

This is my table,i follows your instruction did these step,but still login failed:

http://localhost/corporate_site_admin/user/login
====================================
[07/13/2006 10:47 pm] The system could not log you in.
Make sure that the username and password is correct.
All letters must be typed in using the correct case.
Please try again or contact the site administrator.
====================================

Create New Web,Create New World!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.