Hi Jeremy,
I'll try to illustrate the problem with a specific example.
Lets assume I have a site 'RoomA' and I want to authorize a group 'roomAadmin' to edit that room.
The site object already exists and I created a view/change permission that for dcim->site and assign it to the
roomAadmin group.
# constraint: {"name__in": ["RoomA"]}
This still works well.
Now lets assume that I want to authorize the group to add a Rack (but only to this room).
I create another permission for view/change/add/delete on dcim->rack and assign it to the group.
# constraint: {"site__in": ["RoomA"]}
This is an attribute that I derived from the web response. It doesn't work and gives a nice crash.
# constraint: {"site__name__in": ["RoomA"]}
Got this from the example in the web. It works, but I'm not exactly sure what it does and it feels
more like tinkering than thoughtful configuration.
And finally: my user should be able to create devices in his new Rack. I failed on this in my first try
for obscure reasons, thats why I came here. I just managed to make it work successfully with
some trial-and-error:
# constraint: {"rack__site__name__in": ["RoomA"]}
If I follow that finding, I need one permission per object type. The constraints for these permission
are hard to write. I end up with a huge list of permissions that are all specific/handcrafted for one
group (site 'RoomA'). This seems unmanageable to me.
Questions:
- Is there a proper documentation on how exactly the constraints are designed?
- Do I really have to write one constraint for each object type?
- Is there a way to fuse all these constraints in one permission?
(instead of having one permission per object type)
- Can I 'parameterize' a set of constraints? I'd like to configure something like a
role 'site-admin' and use it for different groups in different rooms.
Thanks in advance
P