Changeset 107f4e in indico


Ignore:
Timestamp:
09/07/10 15:23:12 (3 years ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, new-webex, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
Children:
e52fa3
Parents:
cfb660
git-author:
Leszek Syroka <leszek.marek.syroka@…> (08/26/10 14:44:58)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (09/07/10 15:23:12)
Message:

[FIX] Roombooking access restrictions

  • room booking module can be accessed only by user/groups specified in roombooking plugin setup
  • new type 'usersGroups' added to the plugin system
  • min width added to PluginOptionPeopleListDiv?
  • in UserWidget? 'Group: ' is added before group name
  • fix#474
Location:
indico
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/plugins/RoomBooking/__init__.py

    rbdd862 r107f4e  
    2222pluginTypeDescription = _("Room Booking Plugins") 
    2323ignore = False 
    24 visible = False 
     24visible = True 
  • indico/MaKaC/plugins/base.py

    r8e4bcf r107f4e  
    692692    _extraTypes = { 
    693693        'users': list, 
     694        'usersGroups': list, 
    694695        'rooms': list 
    695696    } 
  • indico/MaKaC/services/implementation/plugins.py

    rbdd862 r107f4e  
    5959         
    6060    def _getAnswer(self): 
    61         if self._targetOption.getType() == 'users': 
     61        if self._targetOption.getType() == 'users' or self._targetOption.getType() == 'usersGroups': 
    6262            optionValue = self._targetOption.getValue() 
    6363            existingUserIds = set([u.getId() for u in optionValue]) 
     
    7878         
    7979    def _getAnswer(self): 
    80         if self._targetOption.getType() == 'users': 
     80        if self._targetOption.getType() == 'users' or self._targetOption.getType() == 'usersGroups': 
    8181            self._targetOption.getValue().remove(self._targetUser) 
    8282            self._targetOption._notifyModification() 
  • indico/MaKaC/webinterface/pages/errors.py

    rebceda r107f4e  
    206206 
    207207    def _getBody( self, params ): 
    208         if self._rh._target.getAccessKey() != "" or ( (not type(self._rh._target) is Category) and self._rh._target.getConference().getAccessKey() != ""): 
     208        if self._rh._target and (self._rh._target.getAccessKey() != "" or ( (not type(self._rh._target) is Category) and self._rh._target.getConference().getAccessKey() != "")): 
    209209            msg = "" 
    210210            sess = self._rh._getSession() 
  • indico/MaKaC/webinterface/rh/base.py

    r3be749 r107f4e  
    6161 
    6262from MaKaC.common.TemplateExec import escapeHTMLForJS 
     63 
     64from MaKaC.plugins.base import PluginsHolder 
     65from MaKaC.user import Group, Avatar 
     66from MaKaC.accessControl import AdminList 
     67 
    6368 
    6469class RequestHandlerBase(object): 
     
    762767 
    763768 
     769class RHRoomBookingProtected( RHProtected ): 
     770 
     771    def _checkSessionUser( self ): 
     772        user = self._getUser() 
     773        if user == None: 
     774            self._redirect( self._getLoginURL() ) 
     775            self._doProcess = False 
     776        else: 
     777            try: 
     778                if PluginsHolder().getPluginType("RoomBooking").isActive(): 
     779                    if not AdminList.getInstance().isAdmin(user): 
     780                        authenticatedUser = False 
     781                        for entity in PluginsHolder().getPluginType("RoomBooking").getOption("AuthorisedUsersGroups").getValue(): 
     782                            if isinstance(entity, Group) and entity.containsUser(user) or \ 
     783                               isinstance(entity, Avatar) and entity == user: 
     784                                    authenticatedUser = True 
     785                                    break 
     786                        if not authenticatedUser: 
     787                            raise AccessError() 
     788            except KeyError: 
     789                pass 
     790 
    764791class RHDisplayBaseProtected( RHProtected ): 
    765792 
  • indico/MaKaC/webinterface/rh/roomBooking.py

    r887156f r107f4e  
    2727from MaKaC.common.general import * 
    2828from MaKaC.common.Configuration import Config 
    29 from MaKaC.webinterface.rh.base import RHProtected, RoomBookingDBMixin 
     29from MaKaC.webinterface.rh.base import RoomBookingDBMixin, RHRoomBookingProtected 
    3030from datetime import datetime, timedelta 
    3131from MaKaC.common.utils import HolidaysHolder, validMail, setValidEmailSeparators 
     
    5252 
    5353 
    54 class RHRoomBookingBase( RoomBookingDBMixin, RHProtected ): 
     54class RHRoomBookingBase( RoomBookingDBMixin, RHRoomBookingProtected ): 
    5555    """ 
    5656    All room booking related hanlders are derived from this class. 
     
    6262 
    6363    def _checkProtection( self ): 
    64         RHProtected._checkProtection(self) 
     64        RHRoomBookingProtected._checkProtection(self) 
    6565 
    6666    def _clearSessionState( self ): 
  • indico/MaKaC/webinterface/tpls/AdminPluginsOptionList.tpl

    r032d31 r107f4e  
    129129                    </script> 
    130130               <% end %> 
     131               <% elif option.getType() == "usersGroups": %> 
     132                    <div id="userGroupList<%=name%>" style="margin-bottom: 10px"> 
     133                    </div> 
     134 
     135                    <script type="text/javascript"> 
     136                        var newPersonsHandler = function(userList, setResult) { 
     137                            indicoRequest( 
     138                                'plugins.addUsers', 
     139                                { 
     140                                    optionName: "<%= name %>", 
     141                                    userList: userList 
     142                                }, 
     143                                function(result,error) { 
     144                                    if (!error) { 
     145                                        setResult(true); 
     146                                    } else { 
     147                                        IndicoUtil.errorReport(error); 
     148                                        setResult(false); 
     149                                    } 
     150                                } 
     151                            ); 
     152                        } 
     153                        var removePersonHandler = function(user, setResult) { 
     154                            indicoRequest( 
     155                                'plugins.removeUser', 
     156                                { 
     157                                    optionName: "<%= name %>", 
     158                                    user: user.get('id') 
     159                                }, 
     160                                function(result,error) { 
     161                                    if (!error) { 
     162                                        setResult(true); 
     163                                    } else { 
     164                                        IndicoUtil.errorReport(error); 
     165                                        setResult(false); 
     166                                    } 
     167                                } 
     168                            ); 
     169                        } 
     170 
     171                        var uf = new UserListField('PluginOptionPeopleListDiv', 'PeopleList', 
     172                                                   <%= jsonEncode(fossilize(option.getValue())) %>, true, null, 
     173                                                   true, true, null, null, 
     174                                                   false, false, true, 
     175                                                   newPersonsHandler, userListNothing, removePersonHandler) 
     176                        $E('userGroupList<%=name%>').set(uf.draw()) 
     177                    </script> 
     178                <% end %> 
    131179                <% else: %> 
    132180                    <% if option.getType() == list: %> 
  • indico/htdocs/css/Default.css

    ra89f94 r107f4e  
    18971897    border: 1px dashed #CCCCCC; 
    18981898    min-height: 25px; 
     1899    min-width: 320px; 
    18991900} 
    19001901 
  • indico/htdocs/js/indico/Management/Users.js

    rd25c08 r107f4e  
    13731373                 var removeButtonDiv = Html.div({style: {cssFloat: "right", paddingRight: pixels(10), paddingTop: pixels(5)}}, removeButton); 
    13741374                 var groupName = $B(Html.span(), userData.accessor('name')); 
    1375                  return Html.span({}, removeButtonDiv, groupName); 
     1375                 return Html.span({}, removeButtonDiv, Html.span({style:{fontWeight:'bold'}}, 'Group: '), groupName); 
    13761376 
    13771377             } else { 
Note: See TracChangeset for help on using the changeset viewer.