Fix datepicker arrows style on hover
[cds-indico.git] / indico / MaKaC / webinterface / rh / services.py
blob0c35931807873b3bc5fd89ebab0738d10dc6b154
1 # This file is part of Indico.
2 # Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
4 # Indico is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3 of the
7 # License, or (at your option) any later version.
9 # Indico is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with Indico; if not, see <http://www.gnu.org/licenses/>.
17 import MaKaC.webinterface.rh.admins as admins
18 import MaKaC.webinterface.urlHandlers as urlHandlers
19 from MaKaC.common import utils
20 from MaKaC.common import info
21 from MaKaC.webinterface.pages import admins as adminPages
22 from MaKaC.errors import MaKaCError
25 class RHServicesBase(admins.RHAdminBase):
26 pass
29 class RHIPBasedACL( RHServicesBase ):
30 """ IP Based ACL Configuration Interface """
32 _uh = urlHandlers.UHIPBasedACL
34 def _process( self ):
35 p = adminPages.WPIPBasedACL(self)
36 return p.display()
38 class RHIPBasedACLFullAccessGrant( RHServicesBase ):
40 _uh = urlHandlers.UHIPBasedACLFullAccessGrant
42 def _checkParams( self, params ):
43 RHServicesBase._checkParams( self, params )
44 self._params = params
46 def _process( self ):
48 ipAddress = self._params.get('ipAddress', None)
50 if ipAddress:
51 if not utils.validIP(ipAddress):
52 raise MaKaCError("IP Address %s is not valid!" % ipAddress)
53 else:
54 minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
55 ip_acl_mgr = minfo.getIPBasedACLMgr()
56 ip_acl_mgr.grant_full_access(ipAddress)
58 self._redirect(urlHandlers.UHIPBasedACL.getURL())
60 class RHIPBasedACLFullAccessRevoke( RHServicesBase ):
62 _uh = urlHandlers.UHIPBasedACLFullAccessRevoke
64 def _checkParams( self, params ):
65 RHServicesBase._checkParams( self, params )
66 self._params = params
68 def _process( self ):
70 ipAddress = self._params.get('ipAddress', None)
72 if ipAddress:
73 minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
74 ip_acl_mgr = minfo.getIPBasedACLMgr()
75 ip_acl_mgr.revoke_full_access(ipAddress)
77 self._redirect(urlHandlers.UHIPBasedACL.getURL())