Bug 723573

Summary: RFE: 'change' loan instead of just return/re-loan process
Product: [Retired] Beaker Reporter: Derrich Hafemann <dhafeman>
Component: web UIAssignee: Raymond Mancy <rmancy>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 0.6CC: bpeck, dcallagh, ebaak, mcsontos, rmancy, stl
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-02 05:07:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Derrich Hafemann 2011-07-20 15:39:40 UTC
Description of problem:

Currently, the Beaker WebUI allows us to either assign a new loan, or to return an existing loan. If a system is loaned already, and we wish to loan it to a new user, we need to first remove the existing loan and then apply a new loan. 

To prevent the scheduler from grabbing the system in between these two actions, we temporarily set the system's status to 'Broken', so the final workflow for changing a loan looks like:

1) Set system to 'Broken'
2) Remove existing loan
3) Apply new loan to second user
4) Set system to 'Automated'

It'd be convenient if there were a way to directly transfer or move an existing loan without having to do the shuffle described above.

Comment 2 Raymond Mancy 2011-08-12 13:41:30 UTC
I've introduced a regression with this. Owner's of systems may have trouble loaning a machine to themselves.

Here are two workarounds

1) If the system has a group (of which you are a part) set the group to have admin rights.

2) Get an Admin to loan it to you.


Because we have these workarounds, I don't think this warrants a hotfix.
Here is the suggested patch though.

diff --git a/Server/bkr/server/model.py b/Server/bkr/server/model.py
index 38cae77..f5f0117 100644
--- a/Server/bkr/server/model.py
+++ b/Server/bkr/server/model.py
@@ -1911,6 +1911,12 @@ def is_admin(self,group_id=None,user_id=None,groups=None,*args,**kw):
                 return True
         except AttributeError,e: pass #We may not be logged in...
 
+        if not user_id:
+            try:
+                user_id = identity.current.user.user_id
+            except AttributeError:
+                pass
+
         #If we are the owner....
         if self.owner == User.by_id(user_id):
             return True

Comment 3 Derrich Hafemann 2011-08-25 16:37:21 UTC
This bug is marked as closed, but the regression described in comment #2 has not (as far as I can see) been resolved.

Am I missing something here?

Comment 4 Raymond Mancy 2011-08-25 22:49:53 UTC
No, that's correct.

Comment 5 Raymond Mancy 2011-09-02 05:07:46 UTC
This is covered by 730321