Index: main/waeup.ikoba/trunk/src/waeup/ikoba/browser/pages.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/browser/pages.py	(revision 13804)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/browser/pages.py	(revision 13806)
@@ -308,4 +308,9 @@
 
     def update(self, SUBMIT=None, camefrom=None):
+        blocker = grok.getSite()['configuration'].maintmode_enabled_by
+        if blocker:
+            self.flash(_('The portal is in maintenance mode '
+                        'and authentication (login) temporarily disabled.'),
+                       type='warning')
         self.camefrom = camefrom
         if SUBMIT is not None:
@@ -335,4 +340,11 @@
                     return
                 self.redirect(self.camefrom)
+                return
+            # Display second warning message and remind user that
+            # s/he can't login.
+            if blocker:
+                self.flash(_('The portal is in maintenance mode. '
+                            'You can\'t login!'),
+                           type='danger')
                 return
             # Display appropriate flash message if credentials are correct
@@ -638,5 +650,5 @@
 
     def render(self):
-        #ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
+        #ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
         #self.context.logger.info(
         #    '%s - skeleton downloaded: %s' % (ob_class, self.filename))
@@ -921,4 +933,5 @@
     form_fields = grok.AutoFields(IConfigurationContainer).omit(
         'frontpage_dict')
+    form_fields['maintmode_enabled_by'].for_display = True
 
     @action(_('Save'), style='primary')
@@ -1193,4 +1206,11 @@
 
     def update(self, filename=None, select=None, cancel=None):
+        if not grok.getSite()['configuration'].maintmode_enabled_by and \
+            not self.request.principal.id == 'admin':
+            self.flash(
+                _('Portal must be in maintenance mode for data import.'),
+                type='warning')
+            self.redirect(self.url(self.context))
+            return
         if cancel is not None:
             self.redirect(self.url(self.context))
@@ -1201,4 +1221,5 @@
             session['import_filename'] = select
             self.redirect(self.url(self.context, '@@import2'))
+        return
 
 class DatacenterImportStep2(IkobaPage):
@@ -1440,4 +1461,12 @@
             self.redirect(self.url(self.context, '@@import1'))
             return
+        if not grok.getSite()['configuration'].maintmode_enabled_by and \
+            not self.request.principal.id == 'admin':
+            self.flash(
+                _('File has not been imported. '
+                  'Portal must be in maintenance mode for data import.'),
+                type='danger')
+            self.redirect(self.url(self.context))
+            return
         session = ISession(self.request)['waeup.ikoba']
         self.filename = session.get('import_filename', None)
@@ -1476,4 +1505,8 @@
             self.warn_num == 0, self.fullpath, fin_path, pending_path,
             self.mode)
+        # Disable maintenance mode if set.
+        if grok.getSite()['configuration'].maintmode_enabled_by:
+            grok.getSite()['configuration'].maintmode_enabled_by = None
+            self.flash(_('Maintenance mode disabled.'))
 
         if self.warn_num:
@@ -1659,4 +1692,32 @@
         return result
 
+class SwitchMaintModePage(UtilityView, grok.View):
+    """Import managers must disable authentication for all other users
+    before starting an import. This pages switches maintenance mode
+    on and off.
+    """
+    grok.context(IDataCenter)
+    grok.name('switchmaintmode')
+    grok.require('waeup.importData')
+
+    def update(self):
+        ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
+        if grok.getSite()['configuration'].maintmode_enabled_by:
+            grok.getSite()['configuration'].maintmode_enabled_by = None
+            self.context.logger.info('%s - maintmode disabled' % ob_class)
+            self.flash(_('Maintenance mode disabled.'))
+            self.redirect(self.url(self.context))
+        else:
+            grok.getSite()['configuration'].maintmode_enabled_by = unicode(
+                self.request.principal.id)
+            self.context.logger.info('%s - maintmode enabled' % ob_class)
+            self.flash(_('Maintenance mode enabled.'), type='warning')
+            self.redirect(self.url(self.context, 'import1'))
+        return
+
+    def render(self):
+        return
+
+
 class ChangePasswordRequestPage(IkobaFormPage):
     """Captcha'd page for all kind of users to request a password change.
Index: main/waeup.ikoba/trunk/src/waeup/ikoba/browser/tests/test_browser.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/browser/tests/test_browser.py	(revision 13804)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/browser/tests/test_browser.py	(revision 13806)
@@ -22,4 +22,5 @@
 import tempfile
 import os
+import grok
 from zc.async.testing import wait_for_result
 from zope.component import createObject, getUtility
@@ -215,4 +216,40 @@
         return
 
+    def test_maintenance_mode(self):
+        config = grok.getSite()['configuration']
+        self.app['users'].addUser(
+            'officer', 'secret', title='Bob Officer', email='bob@abcd.ng')
+        self.browser.open('http://localhost/app/login')
+        self.browser.getControl(name="form.login").value = 'officer'
+        self.browser.getControl(name="form.password").value = 'secret'
+        self.browser.getControl("Login").click()
+        # Officer logged in.
+        self.assertMatches('...You logged in...', self.browser.contents)
+        self.assertTrue("Bob Officer" in self.browser.contents)
+        # If maintenance mode is enabled, officer is immediately logged out.
+        config.maintmode_enabled_by = u'any_user'
+        self.assertRaises(
+            Unauthorized, self.browser.open, 'http://localhost/app/customers')
+        self.browser.open('http://localhost/app/login')
+        self.assertMatches(
+            '...The portal is in maintenance mode...',
+            self.browser.contents)
+        # Officers really can't login if maintenance mode is enabled.
+        self.browser.getControl(name="form.login").value = 'officer'
+        self.browser.getControl(name="form.password").value = 'secret'
+        self.browser.getControl("Login").click()
+        # A second warning is raised.
+        self.assertMatches(
+            '...The portal is in maintenance mode. You can\'t login!...',
+            self.browser.contents)
+        # Offficer can login if s/he is the blocker.
+        config.maintmode_enabled_by = u'officer'
+        self.browser.getControl(name="form.login").value = 'officer'
+        self.browser.getControl(name="form.password").value = 'secret'
+        self.browser.getControl("Login").click()
+        self.assertTrue('You logged in' in self.browser.contents)
+        self.assertTrue('Logout' in self.browser.contents)
+        return
+
     def test_sources_overview(self):
         self.browser.open('http://localhost/app/sources')
Index: main/waeup.ikoba/trunk/src/waeup/ikoba/browser/viewlets.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/browser/viewlets.py	(revision 13804)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/browser/viewlets.py	(revision 13806)
@@ -454,4 +454,27 @@
     text = _('View processed files')
 
+class SwitchMaintMode(ActionButton):
+    grok.context(IDataCenter)
+    grok.require('waeup.importData')
+    #grok.view(DatacenterImportStep1)
+    grok.order(7)
+    icon = 'actionicon_stop.png'
+    target = 'switchmaintmode'
+    text = _('Switch maintenance mode')
+
+    @property
+    def onclick(self):
+        if grok.getSite()['configuration'].maintmode_enabled_by:
+            return
+        return "return window.confirm(%s);" % _(
+            "'In maintenance mode no other user can login, and "
+            "already logged-in users will be automatically logged out. "
+            "You will be the only logged-in user and you can safely start "
+            "any import. Please wait a few seconds before starting the import "
+            "so that all running processes are finished. "
+            "If the import is done, maintenance mode will "
+            "be automatically disabled. \\n\\n"
+            "You really want to enable maintenance mode?'")
+
 #
 # Primary navigation tabs (in upper left navigation bar)...
