Skip to main content

Quick glance at Joomla core ACL table

If you want to create some code to insert a new user in Joomla, it’s not as easy as it seems. Or better: it’s quite easy if you’re already inside the Joomla framework and use its existing methods to create the user.

But what if you want to create a user from an external PHP script, working directly on database tables? ivermectin tableta Or if you want to add a new user “by hand” in database? I did some basic inquiry recently: this is what i learned. ivermec cattle

List of tables

There are a few tables related to user, groups and permissions.

  • #__core_acl_aro
  • #__core_acl_aro_groups
  • #__core_acl_aro_map
  • #__core_acl_aro_sections
  • #__core_acl_groups_aro_map
  • #__users (of course)

Ignoring something…

In the most basic usage, there are a few tables you don’t need to take care of when just creating / deleting a user . Here they are:

#__core_acl_aro_groups : this table is static; it contains all available Joomla groups and unless you plan to have multiple groups (in which case i suggest the very good extension Artof User from Andrew Eddie) should not be edited.

#__core_acl_aro_map : i checked on many Joomla sites and this table is empty. I think we can safely assume that it is no used in a simple environment. topical ivermectin for ear mites in cats

#__core_acl_aro_sections : this table is static; it contains a single section called “users”. I guess its expansion could be related to the usage of the above …acl_aro_map

…but not everything

Now, there are some tables which you have to take care of.

#__users : of course, first step should be to add the record in this table

#__core_acl_aro : a new record is created in this table every time a new user is created. AFAIK, id is autoincrement, section_value is always “users”, order_value is always “0” and hidden is always “0”; so adding to this table should be quite easy. Basically, there is one record in this table for each user in #__users table.

#__core_acl_groups_aro_map : this is the real join between users and groups: only thing is, instead of using id from table #__users, it is used the one from table #__core_acl_aro (as we already said, there is a one-to-one relationship between those two tables).

Let’s sum it up

Ok, then, everytime you want insert a new user, you should:

  1. add a record to *_users table
  2. add a record to *_core_acl_aro which points to id from *_users table
  3. get the id of the new record inserted at step 2
  4. get the id of the group you want to use from *_core_acl_aro_groups
  5. add a record to *_core_acl_groups_aro_map with the id from step 3 and the id from step 4

Easy, huh?