Changeset c3902a in indico
- Timestamp:
- 06/23/11 17:27:11 (2 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
- Children:
- f9bbd4
- Parents:
- c21134
- git-author:
- Adrian Moennich <jerome.ernst.monnich@…> (05/03/11 11:57:14)
- git-committer:
- Pedro Ferreira <jose.pedro.ferreira@…> (06/23/11 17:27:11)
- Location:
- indico/MaKaC
- Files:
-
- 1 added
- 8 edited
-
plugins/RoomBooking/options.py (modified) (1 diff)
-
rb_reservation.py (modified) (4 diffs)
-
rb_room.py (modified) (3 diffs)
-
user.py (modified) (2 diffs)
-
webinterface/pages/admins.py (modified) (4 diffs)
-
webinterface/pages/roomBooking.py (modified) (2 diffs)
-
webinterface/rh/roomBooking.py (modified) (10 diffs)
-
webinterface/rh/roomMappers.py (modified) (8 diffs)
-
webinterface/tpls/RBAdminFrame.tpl (added)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/plugins/RoomBooking/options.py
rc21134 rc3902a 73 73 ("notificationBefore", {"description" : _("Trigger start notifications X minutes before the booking starts. Changes will not affect existing bookings"), 74 74 "type": int, 75 "defaultValue": 0} ) 76 ] 75 "defaultValue": 0} ), 76 ( "Managers", {"description": "Users and Groups authorised to administrate/manage the roombooking module (create/delete/edit all rooms/bookings)", 77 "type": 'usersGroups', 78 "defaultValue": [], 79 "editable": True, 80 "visible": True}), 81 ( "AuthorisedUsersGroups", {"description": "Users and Groups authorised for roombooking module", 82 "type": 'usersGroups', 83 "defaultValue": [], 84 "editable": True, 85 "visible": True})] -
indico/MaKaC/rb_reservation.py
rc21134 rc3902a 1153 1153 if not user: 1154 1154 return False 1155 can = user.is Admin() or \1155 can = user.isRBAdmin() or \ 1156 1156 self.isOwnedBy( user ) or \ 1157 1157 self.room.isOwnedBy( user ) … … 1162 1162 if user == None: 1163 1163 return False 1164 return self.isOwnedBy( user ) or user.is Admin()1164 return self.isOwnedBy( user ) or user.isRBAdmin() 1165 1165 1166 1166 def canReject( self, user ): … … 1168 1168 if user == None: 1169 1169 return False 1170 return self.room.isOwnedBy( user ) or user.is Admin()1170 return self.room.isOwnedBy( user ) or user.isRBAdmin() 1171 1171 1172 1172 def canDelete( self, user ): … … 1174 1174 if user == None: 1175 1175 return False 1176 return user.is Admin()1176 return user.isRBAdmin() 1177 1177 1178 1178 def isOwnedBy( self, avatar ): -
indico/MaKaC/rb_room.py
rc21134 rc3902a 524 524 525 525 if (self.isOwnedBy( user ) and self.isActive) \ 526 or user.is Admin():526 or user.isRBAdmin(): 527 527 return True 528 528 return False … … 544 544 return False 545 545 if (self.isOwnedBy( user ) and self.isActive) \ 546 or user.is Admin():546 or user.isRBAdmin(): 547 547 return True 548 548 return False … … 557 557 if isinstance( accessWrapper, AccessWrapper ): 558 558 if accessWrapper.getUser(): 559 return accessWrapper.getUser().is Admin()559 return accessWrapper.getUser().isRBAdmin() 560 560 else: 561 561 return False 562 562 elif isinstance( accessWrapper, Avatar ): 563 return accessWrapper.is Admin()563 return accessWrapper.isRBAdmin() 564 564 565 565 raise MaKaCError('canModify requires either AccessWrapper or Avatar object') -
indico/MaKaC/user.py
rc21134 rc3902a 54 54 from xml.dom.minidom import parseString 55 55 from copy import deepcopy 56 from MaKaC.plugins.base import PluginsHolder 56 57 57 58 """Contains the classes that implement the user management subsystem … … 1321 1322 if al.isAdmin( self ): 1322 1323 return True 1324 return False 1325 1326 def isRBAdmin(self): 1327 """ 1328 Convenience method for checking whether this user is an admin for the RB module. 1329 Returns bool. 1330 """ 1331 if self.isAdmin(): 1332 return True 1333 for entity in PluginsHolder().getPluginType('RoomBooking').getOption('Managers').getValue(): 1334 if (isinstance(entity, Group) and entity.containsUser(self)) or \ 1335 (isinstance(entity, Avatar) and entity == self): 1336 return True 1323 1337 return False 1324 1338 -
indico/MaKaC/webinterface/pages/admins.py
r181d5f rc3902a 137 137 self._setActiveTab() 138 138 139 frame = WAdminFrame() 139 if self._rh._getUser().isAdmin(): 140 frame = WAdminFrame() 141 else: 142 frame = WRBAdminFrame() 140 143 p = { "body": self._getPageContent( params ), 141 144 "sideMenu": self._sideMenu.getHTML() } … … 232 235 def getTitleTabPixels( self ): 233 236 return 260 237 238 class WRBAdminFrame(WAdminFrame): 239 pass 234 240 235 241 class WPAdmins( WPAdminsBase ): … … 2113 2119 self._tabCtrl = wcomponents.TabControl() 2114 2120 2115 self._subTabRoomBooking = self._tabCtrl.newTab( "booking", _("Room Booking"), \ 2116 urlHandlers.UHRoomBookingPluginAdmin.getURL() ) 2117 self._subTabMain = self._subTabRoomBooking.newSubTab( "main", _("Main"), \ 2118 urlHandlers.UHRoomBookingPluginAdmin.getURL() ) 2121 if self._rh._getUser().isAdmin(): 2122 self._subTabRoomBooking = self._tabCtrl.newTab( "booking", _("Room Booking"), \ 2123 urlHandlers.UHRoomBookingPluginAdmin.getURL() ) 2124 self._subTabMain = self._subTabRoomBooking.newSubTab( "main", _("Main"), \ 2125 urlHandlers.UHRoomBookingPluginAdmin.getURL() ) 2126 else: 2127 self._subTabRoomBooking = self._tabCtrl.newTab( "booking", _("Room Booking"), \ 2128 urlHandlers.UHRoomBookingAdmin.getURL() ) 2119 2129 self._subTabConfig = self._subTabRoomBooking.newSubTab( "configuration", _("Configuration"), \ 2120 2130 urlHandlers.UHRoomBookingAdmin.getURL() ) 2121 2131 self._subTabRoomMappers = self._tabCtrl.newTab( "mappers", _("Room Mappers"), \ 2122 2132 urlHandlers.UHRoomMappers.getURL() ) 2133 2134 def _getNavigationDrawer(self): 2135 if self._rh._getUser().isAdmin(): 2136 return wcomponents.WSimpleNavigationDrawer(_("Room Booking Admin"), urlHandlers.UHRoomBookingPluginAdmin.getURL, bgColor="white") 2137 return wcomponents.WSimpleNavigationDrawer(_("Room Booking Admin"), urlHandlers.UHRoomBookingAdmin.getURL, bgColor="white") 2123 2138 2124 2139 def _getPageContent(self, params): … … 2454 2469 self._subTabRoomBooking.setActive() 2455 2470 2471 def _getSiteArea(self): 2472 return 'Room Booking Administration' 2473 2456 2474 class WPRoomBookingPluginAdmin( WPRoomBookingPluginAdminBase ): 2457 2475 -
indico/MaKaC/webinterface/pages/roomBooking.py
rc21134 rc3902a 144 144 urlHandlers.UHRoomBookingBookingList.getURL( ofMyRooms = True, onlyPrebookings = True, autoCriteria = True ), 145 145 enabled=self._showResponsible) 146 if self._rh._getUser().isRBAdmin(): 147 self._adminSect = wcomponents.SideMenuSection(_("Administration"), \ 148 urlHandlers.UHRoomBookingAdmin.getURL() ) 149 self._adminOpt = wcomponents.SideMenuItem(_("Administration"), \ 150 urlHandlers.UHRoomBookingAdmin.getURL() ) 146 151 147 152 … … 159 164 self._bookingsOpt.addItem( self._usersBookings ) 160 165 self._bookingsOpt.addItem( self._usersPrebookings ) 166 self._leftMenu.addSection( self._adminSect ) 167 self._adminSect.addItem( self._adminOpt ) 161 168 return self._leftMenu 162 169 -
indico/MaKaC/webinterface/rh/roomBooking.py
rc21134 rc3902a 628 628 if self._getUser() == None: 629 629 self._checkSessionUser() 630 elif not self._getUser().is Admin():630 elif not self._getUser().isRBAdmin(): 631 631 raise MaKaCError( "You are not authorized to take this action." ) 632 632 … … 864 864 865 865 # only admins can choose to consult non-active rooms 866 if self._getUser() and self._getUser().is Admin() and params.get( 'isActive', None ) != "on":866 if self._getUser() and self._getUser().isRBAdmin() and params.get( 'isActive', None ) != "on": 867 867 self._isActive = None 868 868 … … 1260 1260 # (i.e. user is logged in) 1261 1261 if self._doProcess: 1262 if not self._candResv.room.isActive and not self._getUser().is Admin():1262 if not self._candResv.room.isActive and not self._getUser().isRBAdmin(): 1263 1263 raise FormValuesError( "You are not authorized to book this room." ) 1264 1264 … … 1401 1401 else: 1402 1402 RHRoomBookingBase._checkProtection(self) 1403 if not self._candResv.room.isActive and not self._getUser().is Admin():1403 if not self._candResv.room.isActive and not self._getUser().isRBAdmin(): 1404 1404 raise MaKaCError( "You are not authorized to book this room." ) 1405 1405 … … 1741 1741 # (Responsible can not cancel a booking!) 1742 1742 if ( not self._resv.isOwnedBy( user ) ) and \ 1743 ( not self._getUser().is Admin() ):1743 ( not self._getUser().isRBAdmin() ): 1744 1744 raise MaKaCError( "You are not authorized to take this action." ) 1745 1745 … … 1780 1780 # Only user/admin can cancell a booking occurrence 1781 1781 # (Owner can not reject his own booking, he should cancel instead) 1782 if self._resv.createdBy != user.getId() and (not user.is Admin()):1782 if self._resv.createdBy != user.getId() and (not user.isRBAdmin()): 1783 1783 raise MaKaCError( "You are not authorized to take this action." ) 1784 1784 … … 1819 1819 # (Owner can not reject his own booking, he should cancel instead) 1820 1820 if ( not self._resv.room.isOwnedBy( user ) ) and \ 1821 ( not self._getUser().is Admin() ):1821 ( not self._getUser().isRBAdmin() ): 1822 1822 raise MaKaCError( "You are not authorized to take this action." ) 1823 1823 … … 1853 1853 # (Owner can not reject his own booking, he should cancel instead) 1854 1854 if ( not user.getRooms() ) and \ 1855 ( not self._getUser().is Admin() ):1855 ( not self._getUser().isRBAdmin() ): 1856 1856 raise MaKaCError( "You are not authorized to take this action." ) 1857 1857 … … 1907 1907 # Only responsible and admin can ACCEPT 1908 1908 if ( not self._resv.room.isOwnedBy( user ) ) and \ 1909 ( not self._getUser().is Admin() ):1909 ( not self._getUser().isRBAdmin() ): 1910 1910 raise MaKaCError( "You are not authorized to take this action." ) 1911 1911 … … 2192 2192 # (Owner can not reject his own booking, he should cancel instead) 2193 2193 if ( not self._resv.room.isOwnedBy( user ) ) and \ 2194 ( not self._getUser().is Admin() ):2194 ( not self._getUser().isRBAdmin() ): 2195 2195 raise MaKaCError( "You are not authorized to take this action." ) 2196 2196 -
indico/MaKaC/webinterface/rh/roomMappers.py
rbdd862 rc3902a 22 22 import MaKaC.roomMapping as roomMapping 23 23 import MaKaC.webinterface.urlHandlers as urlHandlers 24 import MaKaC.errors as erros25 24 import MaKaC.webinterface.rh.admins as admins 26 25 from MaKaC.webinterface import locators 26 from MaKaC.errors import AccessError 27 27 28 28 29 29 class RHRoomMapperProtected( admins.RHAdminBase ): 30 pass 30 def _checkProtection( self ): 31 if self._getUser() is None: 32 self._checkSessionUser() 33 elif not self._getUser().isRBAdmin(): 34 raise AccessError( "You are not authorized to take this action." ) 31 35 32 36 class RHRoomMappers( RHRoomMapperProtected ): … … 36 40 admins.RHAdminBase._checkParams( self, params ) 37 41 self._params = params 38 42 39 43 def _process( self ): 40 44 p = adminPages.WPRoomMapperList( self, self._params ) 41 45 return p.display() 42 46 43 47 44 48 class RHRoomMapperBase( RHRoomMapperProtected ): 45 49 46 50 def _checkParams( self, params ): 47 51 RHRoomMapperProtected._checkParams( self, params ) … … 51 55 class RHRoomMapperDetails( RHRoomMapperBase ): 52 56 _uh = urlHandlers.UHRoomMapperDetails 53 57 54 58 def _process( self ): 55 59 p = adminPages.WPRoomMapperDetails( self, self._roomMapper ) … … 59 63 class RHRoomMapperModification( RHRoomMapperBase ): 60 64 _uh = urlHandlers.UHRoomMapperModification 61 65 62 66 def _process( self ): 63 67 p = adminPages.WPRoomMapperModification( self, self._roomMapper ) … … 67 71 class RHRoomMapperPerformModification( RHRoomMapperBase ): 68 72 _uh = urlHandlers.UHRoomMapperPerformModification 69 73 70 74 def _process( self ): 71 75 self._roomMapper.setValues(self._getRequestParams()) … … 75 79 class RHRoomMapperCreation( RHRoomMapperProtected ): 76 80 _uh = urlHandlers.UHNewRoomMapper 77 81 78 82 def _process( self ): 79 83 p = adminPages.WPRoomMapperCreation( self ) … … 83 87 class RHRoomMapperPerformCreation( RHRoomMapperProtected ): 84 88 _uh = urlHandlers.UHRoomMapperPerformCreation 85 89 86 90 def _process( self ): 87 91 rm = roomMapping.RoomMapper() … … 90 94 rmh.add( rm ) 91 95 self._redirect( urlHandlers.UHRoomMapperDetails.getURL( rm ) ) 92 93 94 95 96 97
Note: See TracChangeset
for help on using the changeset viewer.
