change the permission of all users

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
gacon
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sun May 21, 2006 7:41 pm
Contact:

change the permission of all users

Post by gacon » Mon Sep 17, 2007 2:04 pm

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,
Last edited by gacon on Mon Sep 17, 2007 2:07 pm, edited 1 time in total.
Ý Nghĩa . com http://www.ynghia.com/

User avatar
bascherz
Joomla! Intern
Joomla! Intern
Posts: 86
Joined: Mon Jan 16, 2006 1:33 am
Location: Vienna, VA
Contact:

Re: change the permission of all users

Post by bascherz » Mon Sep 17, 2007 11:45 pm

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.
__________________
Bruce Scherzinger

User avatar
gacon
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sun May 21, 2006 7:41 pm
Contact:

Re: change the permission of all users

Post by gacon » Tue Sep 18, 2007 1:35 am

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!
Ý Nghĩa . com http://www.ynghia.com/

User avatar
gacon
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sun May 21, 2006 7:41 pm
Contact:

Re: change the permission of all users

Post by gacon » Tue Sep 18, 2007 2:09 am

This is the content of jos_core_acl_groups_aro_map


Image


Note: I have removed the CB component


Thanks for your help!
Last edited by gacon on Tue Sep 18, 2007 2:26 am, edited 1 time in total.
Ý Nghĩa . com http://www.ynghia.com/

User avatar
bascherz
Joomla! Intern
Joomla! Intern
Posts: 86
Joined: Mon Jan 16, 2006 1:33 am
Location: Vienna, VA
Contact:

Re: change the permission of all users

Post by bascherz » Tue Sep 18, 2007 2:36 am

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!
__________________
Bruce Scherzinger

jcisio
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Mon Apr 16, 2007 2:33 pm
Contact:

Re: change the permission of all users

Post by jcisio » Fri Sep 21, 2007 8:05 am

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)
http://thongtincongnghe.com/ - Thông tin công nghệ

User avatar
gacon
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sun May 21, 2006 7:41 pm
Contact:

Re: change the permission of all users

Post by gacon » Sat Sep 22, 2007 10:38 am

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).
Ý Nghĩa . com http://www.ynghia.com/

jcisio
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Mon Apr 16, 2007 2:33 pm
Contact:

Re: change the permission of all users

Post by jcisio » Sat Sep 22, 2007 10:51 am

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.
Last edited by jcisio on Mon Sep 24, 2007 1:40 pm, edited 1 time in total.
http://thongtincongnghe.com/ - Thông tin công nghệ

User avatar
gacon
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sun May 21, 2006 7:41 pm
Contact:

Re: change the permission of all users

Post by gacon » Mon Oct 08, 2007 10:15 am

not yet successful. Anyone can help me?
Ý Nghĩa . com http://www.ynghia.com/

jcisio
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Mon Apr 16, 2007 2:33 pm
Contact:

Re: change the permission of all users

Post by jcisio » Mon Oct 08, 2007 11:40 am

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.
http://thongtincongnghe.com/ - Thông tin công nghệ

User avatar
gacon
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sun May 21, 2006 7:41 pm
Contact:

Re: change the permission of all users

Post by gacon » Mon Oct 08, 2007 3:19 pm

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).
Ý Nghĩa . com http://www.ynghia.com/

jcisio
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Mon Apr 16, 2007 2:33 pm
Contact:

Re: change the permission of all users

Post by jcisio » Mon Oct 08, 2007 3:23 pm

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.
http://thongtincongnghe.com/ - Thông tin công nghệ

User avatar
ircmaxell
Joomla! Intern
Joomla! Intern
Posts: 52
Joined: Thu Nov 10, 2005 3:10 am
Location: BumbleF&%K, NJ
Contact:

Re: change the permission of all users

Post by ircmaxell » Mon Oct 08, 2007 4:20 pm

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
Joomla Development WorkGroup - Joomla BugSquad!
http://www.joomlaperformance.com For All Your Joomla Performance Needs
http://www.ircmaxell.com
The greatest obstacle to discovery is not ignorance, but the delusion of knowledge.

User avatar
gacon
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sun May 21, 2006 7:41 pm
Contact:

Re: change the permission of all users

Post by gacon » Tue Oct 09, 2007 6:50 am

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

Ý Nghĩa . com http://www.ynghia.com/


Post Reply