Changeset 1146

Show
Ignore:
Timestamp:
08/26/10 02:48:49 (21 months ago)
Author:
winfried
Message:

Cleaning up textpages scripts, unifying them to one script sensitive for
the location requested. This needed some fix in the application.py too:
it authorized against script name, not against location requested.
refs #206

Location:
HelpIM3
Files:
14 removed
4 modified

Legend:

Unmodified
Added
Removed
  • HelpIM3/HelpIM/appl/application.py

    r1125 r1146  
    299299                moduleName = resourceConfig.module 
    300300                scriptName = resourceConfig.script 
    301                 packageName, className = self.getPackageName(site, scriptName) 
    302301                location = resourceConfig.location 
     302                packageName, className = self.getPackageName(site, location) 
    303303            else: 
    304304                moduleName = resourceConfig.Class.module 
    305305                scriptName = resourceConfig.Class.script 
    306                 packageName, className = self.getPackageName(site, scriptName) 
    307306                location = resourceConfig.Class.id 
    308              
    309             if not site.userIsAuthorized(user=him_request.session.session_user, script=scriptName): 
     307                packageName, className = self.getPackageName(site, location) 
     308             
     309            if not site.userIsAuthorized(user=him_request.session.session_user, script=location): 
    310310                if him_request.session.session_user is None: 
    311311                    self.log.debug("User(None) with Role(None) is not authorized to access Location(%s.%s)" % (moduleName, location)) 
  • HelpIM3/HelpIM/intranet/pages/EditTextPanel.py

    r1121 r1146  
    44import xml.sax.saxutils as saxutils 
    55 
    6 class EditTextPanel(EditTextPanelTemplate): 
     6class Handler(EditTextPanelTemplate): 
    77 
    88    """Show login panel - (does what it says) 
     
    1010    """ 
    1111    def __init__(self, *args, **kwargs): 
    12         super(EditTextPanel, self).__init__(*args, **kwargs) 
     12        super(Handler, self).__init__(*args, **kwargs) 
    1313        import logging 
    1414        self.log = logging.getLogger('HelpIM.intranet.pages.EditTextpanel.Handler') 
    15         self.panelId = 'EditTextPanel' 
    16         self.panelName = 'Edit news' 
    17          
     15        self.panelId = 'EditTextPanel'         
     16 
     17        path = kwargs['him_request'].environment['PATH_INFO'] 
     18        if path[:1] == '/': 
     19            path = path[1:] 
     20        self.panelName = path 
     21        self.function = path 
     22        self.panelId = path+"Panel" 
     23        self.newsType = path[4:] 
     24 
    1825         
    1926    def getPanelData(self, *pargs, **kwargs): 
     
    6471            self.site.flush(self.site) 
    6572        self.panelMessage = 'Text %s is opgeslagen...' % self.newsType 
     73 
     74         
     75    def getMenuAttributes(self, *pargs, **kwargs): 
     76        return { 'currentMenu':     '', 
     77                 'currentSubMenu':  '' 
     78            } 
     79 
  • HelpIM3/HelpIM/intranet/pages/ShowTextPanel.py

    r1122 r1146  
    33import xml.sax.saxutils as saxutils 
    44 
    5 class ShowTextPanel(ShowTextPanelTemplate): 
     5class Handler(ShowTextPanelTemplate): 
    66 
    77    """Show login panel - (does what it says) 
     
    99    """ 
    1010    def __init__(self, *args, **kwargs): 
    11         super(ShowTextPanel, self).__init__(*args, **kwargs) 
     11        super(Handler, self).__init__(*args, **kwargs) 
    1212        import logging 
    1313        self.log = logging.getLogger('HelpIM.intranet.pages.ShowTextpanel.Handler') 
    14         self.panelId = 'ShowTextPanel' 
    15         self.panelName = 'self.panelName' 
     14        path = kwargs['him_request'].environment['PATH_INFO'] 
     15        if path[:1] == '/': 
     16            path = path[1:] 
     17        self.panelName = path 
     18        self.panelId = path+"Panel" 
     19        self.function = path 
     20        if path[:4] == 'Show': 
     21            path = path[4:] 
     22        self.newsType = path 
     23        self.editFunction = 'Edit'+path 
    1624 
    1725    def getPanelData(self, *pargs, **kwargs): 
     
    3947        return [panel_data, fieldErrors, panelMessage] 
    4048 
     49    def getMenuAttributes(self, *pargs, **kwargs): 
     50        return { 'currentMenu':     '', 
     51                 'currentSubMenu':  '' 
     52            } 
    4153     
  • HelpIM3/config/sites/localhost.xml

    r1144 r1146  
    9797 
    9898                <!-- Intranet --> 
    99                 <page location="EditNationalNews" module="intranet" script="EditNationalNews" 
    100                         allowCookies="True" /> 
    101                 <page location="ShowNationalNews" module="intranet" script="ShowNationalNews" 
    102                         allowCookies="True" /> 
    103                 <page location="EditManual" module="intranet" script="EditManual" 
    104                         allowCookies="True" /> 
    105                 <page location="ShowManual" module="intranet" script="ShowManual" 
    106                         allowCookies="True" /> 
    107                 <page location="EditCases" module="intranet" script="EditCases" 
    108                         allowCookies="True" /> 
    109                 <page location="ShowCases" module="intranet" script="ShowCases" 
    110                         allowCookies="True" /> 
    111                 <page location="ShowDisclaimer" module="intranet" script="ShowDisclaimer" 
    112                         allowCookies="True" /> 
    113                 <page location="ShowFrontPage" module="intranet" script="ShowFrontPage" 
    114                         allowCookies="True" /> 
    115                 <page location="ShowTerms" module="intranet" script="ShowTerms" 
    116                         allowCookies="True" /> 
    117                 <page location="EditDisclaimer" module="intranet" script="EditDisclaimer" 
    118                         allowCookies="True" /> 
    119                 <page location="EditFrontPage" module="intranet" script="EditFrontPage" 
    120                         allowCookies="True" /> 
    121                 <page location="EditTerms" module="intranet" script="EditTerms" 
     99                <page location="EditNationalNews" module="intranet" script="EditTextPanel" 
     100                        allowCookies="True" /> 
     101                <page location="ShowNationalNews" module="intranet" script="ShowTextPanel" 
     102                        allowCookies="True" /> 
     103                <page location="EditManual" module="intranet" script="EditTextPanel" 
     104                        allowCookies="True" /> 
     105                <page location="ShowManual" module="intranet" script="ShowTextPanel" 
     106                        allowCookies="True" /> 
     107                <page location="EditCases" module="intranet" script="EditTextPanel" 
     108                        allowCookies="True" /> 
     109                <page location="ShowCases" module="intranet" script="ShowTextPanel" 
     110                        allowCookies="True" /> 
     111                <page location="ShowDisclaimer" module="intranet" script="ShowTextPanel" 
     112                        allowCookies="True" /> 
     113                <page location="ShowFrontPage" module="intranet" script="ShowTextPanel" 
     114                        allowCookies="True" /> 
     115                <page location="ShowTerms" module="intranet" script="ShowTextPanel" 
     116                        allowCookies="True" /> 
     117                <page location="EditDisclaimer" module="intranet" script="EditTextPanel" 
     118                        allowCookies="True" /> 
     119                <page location="EditFrontPage" module="intranet" script="EditTextPanel" 
     120                        allowCookies="True" /> 
     121                <page location="EditTerms" module="intranet" script="EditTextPanel" 
    122122                        allowCookies="True" /> 
    123123 
     
    139139 
    140140        <UnAuthorizedResource key="EmptyPage" /> 
    141         <UnAuthorizedResource key="ShowLoginPanel" /> 
     141        <UnAuthorizedResource key="login" /> 
    142142        <UnAuthorizedResource key="PasswordRecover" />         
    143143        <UnAuthorizedResource key="RegisterUser" />