Changeset 5111


Ignore:
Timestamp:
17/03/09 16:22:42 (10 years ago)
Author:
cbyrom
Message:

Disable (old) security code from MILK stack +
make handling of edit mode on/off more robust - redirecting users
back to 'discovery' home page when not in edit mode.

Location:
MILK/trunk/milk_server/milk_server
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • MILK/trunk/milk_server/milk_server/config/milkMiddleware.py

    r5099 r5111  
    4545        self.globals.icons_R=cf.get('RELATED','icon') 
    4646        self.globals.icons_key=cf.get('layout','key') 
    47         self.globals.debugModeOn = cf.get('DEFAULT','debug') or False 
    48  
    49         self.globals.atomEditorEnabled = cf.get('ATOM_EDITOR','enabled') 
     47        debugMode = cf.get('DEFAULT','debug') or False 
     48        if debugMode and debugMode.lower == 'true': 
     49            debugMode = True 
     50        self.globals.debugModeOn = debugMode 
     51         
     52        editModeOn = cf.get('ATOM_EDITOR','enabled') or False 
     53        if editModeOn and editModeOn.lower == 'true': 
     54            editModeOn = True 
     55        self.globals.atomEditorEnabled = editModeOn  
    5056 
    5157        self.globals.wmcClientURL = cf.get('WMC_CLIENT','url') 
  • MILK/trunk/milk_server/milk_server/controllers/atom_editor/atomeditorcontroller.py

    r5085 r5111  
    2727        Default is True.  
    2828        ''' 
     29        # check the editor is enabled first 
     30        if g.atomEditorEnabled != 'True': 
     31            logging.info("Editor not enabled - cannot edit atoms - redirect to 'view' mode") 
     32            return h.redirect_to(h.url_for('discovery')) 
     33 
    2934        logging.info("Setting up AtomEditorController") 
    3035        self.cf=request.environ['ndgConfig'] 
  • MILK/trunk/milk_server/milk_server/controllers/atom_editor/editatom.py

    r5076 r5111  
    645645        Create a new atom from a granulite file 
    646646        ''' 
     647        self._setup() 
    647648        logging.info("Setting up new atom from granulite template") 
    648649        c.title='Create new data granule atom - from a granulite file' 
  • MILK/trunk/milk_server/milk_server/controllers/atom_editor/listatom.py

    r5099 r5111  
    2424        ''' 
    2525        logging.info("Rendering atom home page") 
     26        self._setup() 
    2627        c.title = ATOM_HOME_TITLE 
    2728        return self.savePageAndRender("atom_editor/atom_home") 
     
    3334        ''' 
    3435        logging.info("Rendering example granulite file page") 
     36        self._setup() 
    3537        c.title = EXAMPLE_GRANULITE_TITLE 
    3638        return self.savePageAndRender("atom_editor/granulite_example") 
     
    4244        ''' 
    4345        logging.info("Rendering help page") 
     46        self._setup() 
    4447        c.title = HELP_PAGE_TITLE 
    4548        return self.savePageAndRender("atom_editor/atom_help") 
  • MILK/trunk/milk_server/milk_server/lib/ndgInterface.py

    r4998 r5111  
    157157        #   exceptions, status=0, xmlh='Exception(e)' 
    158158         
    159         status,xmlh=self.__gatekeep(ndgObj,xmlh) 
    160         if status: 
    161             if cleared is None: 
    162                 session['ndgCleared']=[uri] 
    163             else: 
    164                 session['ndgCleared'].append(uri) 
    165             session.save() 
     159#        status,xmlh=self.__gatekeep(ndgObj,xmlh) 
     160#        if status: 
     161#            if cleared is None: 
     162#                session['ndgCleared']=[uri] 
     163#            else: 
     164#                session['ndgCleared'].append(uri) 
     165#            session.save() 
    166166        
     167        if cleared is None: 
     168            session['ndgCleared']=[uri] 
     169        else: 
     170            session['ndgCleared'].append(uri) 
     171        session.save() 
    167172        return status, xmlh 
    168173             
  • MILK/trunk/milk_server/milk_server/templates/atom_editor/atom_editor.html

    r5020 r5111  
    5757                            <h3>  $c.title </h3> 
    5858                                ${Markup(h.form(h.url_for(controller='atom_editor/editatom', action='edit', uri=c.atom.ndgURI)))} 
    59                                         <input py:if="not c.saveLink" name="Edit" type="submit" value="Edit" /> 
     59                                        <input py:if="not c.saveLink and g.atomEditorEnabled == 'True'" name="Edit" type="submit" value="Edit" /> 
    6060                                ${Markup(h.end_form())} 
    6161                                ${Markup(h.form(h.url_for(controller='atom_editor/editatom', action='delete', uri=c.atom.ndgURI)))} 
Note: See TracChangeset for help on using the changeset viewer.