Good morning,
The basic examples out there for resource_access_query work for us for the most part, but we do have a scenario I need your help with to get it easier to manage.
We are trying to use active directory for authorization and authentication. For the most part we got that working. We have been using vips and creating two groups for each: vipname-users, and vipname-admins. This was done to attempt to fit this in to the existing examples that are out on the web.
{resource_access_query,
{for, [
%%create, destroy, or alter behaviour
{permission, configure,
{for, [{resource, queue, {in_group, "cn=${vhost}-admins,ou=vhosts,ou=IT,ou=US,ou=Servers,dc=company,dc=com"}},
{resource, exchange, {in_group, "cn=${vhost}-admins,ou=vhosts,ou=IT,ou=US,ou=Servers,dc=company,dc=com"}}]}},
%%write messages
{permission, write,
{for, [
{resource, queue, {in_group, "cn=${vhost}-users,ou=vhosts,ou=IT,ou=US,ou=Servers,dc=company,dc=com"}},
{resource, exchange, {in_group, "cn=${vhost}-users,ou=vhosts,ou=IT,ou=US,ou=Servers,dc=company,dc=com"}}]}},
%%read messages
{permission, read,
{for, [
{resource, queue, {in_group, "cn=${vhost}-users,ou=vhosts,ou=vhosts,ou=IT,ou=US,ou=Servers,dc=company,dc=com"}},
{resource, exchange, {in_group, "cn=${vhost}-users,ou=vhosts,ou=IT,ou=US,ou=Servers,dc=company,dc=com"}}]}}
]
}},
The problem with this is two fold. First, the ${vhost-admins} need read and write as well. I have been adding until I know how to fix this the admin users to both the active directory groups ${vhost}-admins and ${vhost}-users. This works.
Ideally, though, I would rather the resource_access_query allow the admins configure, read, and write.
I tried for example for write permission something like (add admins to it):
{permission, write,
{for, [
{resource, queue, {in_group, "cn=${vhost}-admins,ou=vhosts,ou=IT,ou=US,ou=Servers,dc=company,dc=com"}},
{resource, exchange, {in_group, "cn=${vhost}-admins,ou=vhosts,ou=IT,ou=US,ou=Servers,dc=company,dc=com"}},
{resource, queue, {in_group, "cn=${vhost}-users,ou=vhosts,ou=IT,ou=US,ou=Servers,dc=company,dc=com"}},
{resource, exchange, {in_group, "cn=${vhost}-users,ou=vhosts,ou=IT,ou=US,ou=Servers,dc=company,dc=com"}}]}},
rabbitmq starts up fine, but surprise, it seem to read the first entry for queue and the first for exchange and ignore the rest.
There is no in_groups. Does {in_group [ "$vhost-users", "$vhost-admins" ]} work?
I see there is ways to use 'and', 'or', and 'but', but format is royally confusing. I would appreciate getting an example that shows what I am trying to accomplish.
There is a side question to all this too. Do consumers even need write? I think I was binding a queue to an exchange in my consumer code, and I think that was making it so I had to give ${vhost-users} write permission. I am going to test tha out.