Description of problem:
I am unable to reserve a system thru Beaker if:
[a] The system is currently taken by another user.
[b] The system has group acls.
[c] I am a member of one of the groups with permissions on the system.
Steps to Reproduce:
1. Chose a system that has group acls and is currently taken by another user.
2. You must be a member of one of the groups with system permissions.
3. Try a reserve workflow thru Beaker.
4. On the reserve page choose "Show Systems".
The system that you are trying to reserve will not show up in the selection window. Thus, you are unable to queue the reservation.
As I have permissions to the system, the system should appear in the selection window allowing me to queue the reservation.
This is really broken now.
It looks like this removed the need for users to be in the systems group.
Ray, can you explain how the case statement is supposed to work?
I think we will need to revert this change if it can't be solved quickly.
Here is my patch.
diff --git a/Server/bkr/server/model.py b/Server/bkr/server/model.py
index 048690e..7a52ae7 100644
@@ -1511,17 +1511,21 @@ $SNIPPET("rhts_post")
If a system is loaned then its only available for that person.
- query = systems
+ query = systems.outerjoin(['groups','users'], aliased=True)
+ except AttributeError, (e):
+ log.error('A non Query object has been passed into the all method, using default quer
+ query = cls.query().outerjoin(['groups','users'], aliased=True)
query = System.all(user)
query = query.filter(and_(
- case([(System.groups == None,1),(System.groups.any(User.groups.any(Us
The case statement said
(Systm.groups == None,1)
"If the System has no group, then they can reserve it"
(System.groups.any(User.groups.any(User.user_id == user.user_id)),1)
"If there are any groups of the system that are also groups of the current user, then they can reserve it"
If neither of the above two don't pass then they can't reserve it.
then OK, If the System has any groups that the user is a part of
Can you show me what test case you used?
I ran it against a reserve_workflow and System->Available, I didn't get back any systems that were in groups.
Oh I see the patch is already on....nm