Page 1 of 1

change the permission of all users

Posted: Mon Sep 17, 2007 2:04 pm
by gacon
Hello all,

I would like to change the permission of all users on my site from author to registered, which table and field I should modify?

I'm using CB component.

Thanks,

Re: change the permission of all users

Posted: Mon Sep 17, 2007 11:45 pm
by bascherz
Open (browse) the table named jos_core_acl_aro_groups. It will list the various types of users. Write down the group_id for the user type "Registered". For the sake of example, let's say that number is 18. Next, enter the following SQL command:

Code: Select all

UPDATE jos_users SET gid=18, usertype='Registered' WHERE usertype='Author';

That should do the trick for you.

Of course, always make a backup of the table you are modifying and it's always a good idea to take your site offline while you do this kind of stuff.

Re: change the permission of all users

Posted: Tue Sep 18, 2007 1:35 am
by gacon
I have used this command:

UPDATE jos_users SET gid=18, usertype='Registered' WHERE id > 63;

When i check in the PhpMyAdmin window:

Image

But when i use User Manage of Joomla, nothing change:

Image


thanks for your help!

Re: change the permission of all users

Posted: Tue Sep 18, 2007 2:09 am
by gacon
This is the content of jos_core_acl_groups_aro_map


Image


Note: I have removed the CB component


Thanks for your help!

Re: change the permission of all users

Posted: Tue Sep 18, 2007 2:36 am
by bascherz
In the response I ended up deleting, I was trying to write an SQL statement that would set jos_core_acl_groups_aro_map.group_id to 18 for every user whose jos_users.id is > 67 (or whose jos_core_acl_aro.value > 67). I believe that's what is needed, though I am struggling to create a single SQL statement that does it. I am not sure it can be done entirely in SQL, but I have reached the limit of my MySQL expertise trying to solve this. It may require some coding (PHP or otherwise).

The following invalid SQL statement captures the spirit of what is needed, but does not work:

Code: Select all

...
UPDATE
(SELECT group_id FROM jos_core_acl_aro AS acl
 INNER JOIN jos_core_acl_groups_aro_map AS map
 ON acl.aro_id=map.aro_id
 WHERE map.value>67 AND map.group_id=19)
AS temp_table
SET temp_table.group_id=18
...

I apologize for leading you down this path only to get lost. Negative karma for me!

Re: change the permission of all users

Posted: Fri Sep 21, 2007 8:05 am
by jcisio
Something like this should work:

Code: Select all

UPDATE users, acl_map, aro
SET users.type='Registered', users.gid=18, acl_map.gid=18
WHERE users.type='Author' AND users.id=aro.userid AND aro.acl=acl_map.aro


(from http://forum.joomla.org/index.php/topic,213582.0.html)

Re: change the permission of all users

Posted: Sat Sep 22, 2007 10:38 am
by gacon
jcisio wrote:Something like this should work:

Code: Select all

UPDATE users, acl_map, aro
SET users.type='Registered', users.gid=18, acl_map.gid=18
WHERE users.type='Author' AND[b] users.id=aro.userid[/b] AND aro.acl=acl_map.aro


(from http://forum.joomla.org/index.php/topic,213582.0.html)


You have tried? There is no the field userid in the table jos_core_acl_aro (I made in bold in your code).

Re: change the permission of all users

Posted: Sat Sep 22, 2007 10:51 am
by jcisio
gacon wrote:
jcisio wrote:Something like this should work:

Code: Select all

UPDATE users, acl_map, aro
SET users.type='Registered', users.gid=18, acl_map.gid=18
WHERE users.type='Author' AND[b] users.id=aro.userid[/b] AND aro.acl=acl_map.aro


(from http://forum.joomla.org/index.php/topic,213582.0.html)


You have tried? There is no the field userid in the table jos_core_acl_aro (I made in bold in your code).


I'm pretty sure, at least it's syntaxically correct.

ARO has a relation Access <-> Request (User Id, Group Id), feel free to modify to fit your need.

Re: change the permission of all users

Posted: Mon Oct 08, 2007 10:15 am
by gacon
not yet successful. Anyone can help me?

Re: change the permission of all users

Posted: Mon Oct 08, 2007 11:40 am
by jcisio
gacon wrote:not yet successful. Anyone can help me?


Have you tried my query ? Please post the one you tried if it didn't work.

Re: change the permission of all users

Posted: Mon Oct 08, 2007 3:19 pm
by gacon
please review my previous post.

There is no the field userid in the table jos_core_acl_aro (I made in bold in your code).

Re: change the permission of all users

Posted: Mon Oct 08, 2007 3:23 pm
by jcisio
gacon wrote:please review my previous post.

There is no the field userid in the table jos_core_acl_aro (I made in bold in your code).


Change to the appropriate field (as I said before). The query shouldn't work and I don't have Joomla! db structure here, but if you change it, it will work. I just figure the idea, hope you get it.

Re: change the permission of all users

Posted: Mon Oct 08, 2007 4:20 pm
by ircmaxell
This will sync your jos_core_acl_groups_aro_map with jos_users

Code: Select all

UPDATE jos_core_acl_groups_aro_map AS a
JOIN jos_core_acl_aro AS b ON a.aro_id = b.aro_id
JOIN jos_users AS c ON b.value = c.id
SET a.group_id = c.gid

Re: change the permission of all users

Posted: Tue Oct 09, 2007 6:50 am
by gacon
Thanks so much  :)

It's well done with this command.



ircmaxell wrote:This will sync your jos_core_acl_groups_aro_map with jos_users

Code: Select all

UPDATE jos_core_acl_groups_aro_map AS a
JOIN jos_core_acl_aro AS b ON a.aro_id = b.aro_id
JOIN jos_users AS c ON b.value = c.id
SET a.group_id = c.gid