Ignore:
Timestamp:
Aug 6, 2008, 1:07:22 AM (16 years ago)
Author:
price
Message:

add and respect 'adminable' column to machines

This is for selectively, temporarily, manually enabling admin mode
for a VM. Where it's not set, admin mode now bypasses quotas and does
nothing else.

Location:
trunk/packages/sipb-xen-www/code
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-www/code/validation.py

    r867 r874  
    126126def haveAccess(user, state, machine):
    127127    """Return whether a user has administrative access to a machine"""
    128     return state.isadmin or user in cache_acls.accessList(machine)
     128    return (user in cache_acls.accessList(machine)
     129            or (machine.adminable and state.isadmin))
    129130
    130131def owns(user, machine):
  • trunk/packages/sipb-xen-www/code/webcommon.py

    r867 r874  
    22
    33import time
     4from invirt import database
    45from invirt.database import Machine, MachineAccess
    56
     
    4546    def getMachines(self):
    4647        if self.isadmin:
    47             return Machine.select()
     48            return Machine.query().join('acl').select_by(
     49                database.or_(MachineAccess.c.user == self.username,
     50                             Machine.c.adminable == True))
    4851        else:
    4952            return Machine.query().join('acl').select_by(user=self.username)
Note: See TracChangeset for help on using the changeset viewer.