Group association with Site roles

Mohammed Sulaiman, modified 6 Years ago. New Member Posts: 18 Join Date: 7/7/17 Recent Posts
I need information where liferay stores the  assigned site roles to the groups in Database.
I found the table groups_roles but it doesn't show entries for roles associated with groups.
Thanks.
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Mohammed Sulaiman:

I need information where liferay stores the  assigned site roles to the groups in Database.
I found the table groups_roles but it doesn't show entries for roles associated with groups.
No, you don't.
Trying to understand the database inadvertently leads to attempts to manipulate it, and that has always led to disaster, sooner or later.
Use the API to get what you need, don't even attempt to look at the database.
Trust me, you and your team will be very thankful - if not today, then your future self will be one day.
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Olaf is right -- but we also just can't help ourselves sometimes! emoticon I also think that they reason you can't find it, if I understand what you are asking, is because it doesn't exist. Roles are a Instance level item -- meaning they are associate with a portal instance (or domain).  So if I have a site www.abc.com, internally, that is assigned to companyId 1234. All the roles I add are also associated with companyId 1234, regardless of the "type" of role I create (Regular, Site, Organization). This means if I add a site role "Employee" then that "Employee" site role is available on any of the groups (sites) that are associated with www.abc.com or companyId 1234. 

Taking this further, if I then use the multi-tenant feature of the portal and create a second virtual instance with www.xyz.com, which ends up with a companyId 5678, this NEW instance will not have the "Employee" role. 

Roles are assigned directly to Users, or to User Groups -- this means that you aren't going to find a table with the "group <-> role" assignment (as I say this I am doubting myself a little, lol, but I am ALMOST POSITIVE this is a true statement). What you will find though is a Users_Roles ... and by looking up the Role based on the roleId from that table, you will be able to figure out the type of role. 

NOW! all that said ... why don't you tell us what you are trying to do, and to Olaf point, I'll bet we can hook you up with an API (service) call you can make to get what you need emoticon
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
I need to correct myself. I was really second guessing what I said, and then I started to think about the fact that a user can be in more than one group and have different roles in different groups. I went and looked at the schema and sure enough, there is a Groups_Roles table -- which I think is what you originally said you were looking for. If you want to find a users assigned roles inside a specific group, then there is a UserGroupRole table. BUT! ALL OF THIS SAID, Olaf's original statement still stands! DON'T WORK WITH THE TABLES DIRECTLY ... always use the services.