Bug 723573 - RFE: 'change' loan instead of just return/re-loan process
Summary: RFE: 'change' loan instead of just return/re-loan process
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: web UI
Version: 0.6
Hardware: Unspecified
OS: Unspecified
low
low vote
Target Milestone: ---
Assignee: Raymond Mancy
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-20 15:39 UTC by Derrich Hafemann
Modified: 2019-05-22 13:40 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-09-02 05:07:46 UTC


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.