A user noticed that when performing the following sequence:

 1) Click on a host in the Host List
 2) Reserve that host (creates an ACL in that user's login, if not already
 present and ACLs the host to it) via the View Host "Reserve" button
 3) Return to the Host List and click on a different host
 4) Reserve that host via the View Host "Reserve" button
 5) Return to the Host List again and see that the first host is no
 longer ACL'd

This is because the reservations code unconditionally clears all hosts
already ACL'd to the same ACL as the current reservation, before adding
the newly ACL'd hosts to the ACL. Remove this.

---

The comment implies that is not the intent, but that instead the intent
was to ensure the host is not under two ACLs at the same time -- I'm not
sure that's a problem in the first place as you wouldn't be able to ACL
the host to yourself as a user if you didn't have permission to, to
begin with -- meaning you were on the first ACL.

I'm actually not sure how you'd remove the host from other ACLs except
to iterate over all the ACLs in the system?

Signed-off-by: Nishanth Aravamudan <[email protected]>

diff --git a/frontend/afe/reservations.py b/frontend/afe/reservations.py
index 275d2af..a2b8276 100644
--- a/frontend/afe/reservations.py
+++ b/frontend/afe/reservations.py
@@ -75,8 +75,6 @@ def create(hosts_to_reserve, username=None):
         user_acl.users = [user]
         user_acl.save()
     for host in hosts:
-        # remove host from other acls
-        user_acl.hosts.clear()
         host.aclgroup_set.add(user_acl)
         # and add to reservation acl
         user_acl.hosts.add(*hosts)

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to