Changeset 874 for trunk/packages


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
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-database/debian/changelog

    r842 r874  
     1sipb-xen-database (10.18) unstable; urgency=low
     2
     3  * add 'adminable' column to machines; for selectively, temporarily,
     4    enabling admin mode on a machine
     5
     6 -- Greg Price <price@mit.edu>  Wed,  6 Aug 2008 01:02:59 -0400
     7
    18sipb-xen-database (10.17) unstable; urgency=low
    29
  • trunk/packages/sipb-xen-database/python/database/models.py

    r630 r874  
    2121           'CDROM',
    2222           'Autoinstall',
     23           'or_',
    2324           ]
    2425
     
    3738       Column('type_id', String, ForeignKey('types.type_id'), nullable=False),
    3839       Column('autorestart', Boolean, nullable=False, default=False),
    39        Column('cpus', Integer, nullable=False, default=1))
     40       Column('cpus', Integer, nullable=False, default=1),
     41       Column('adminable', Boolean, nullable=False, default=False))
    4042
    4143nic_table = Table('nics', meta,
  • 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.