Index: /main/waeup.kofa/trunk/CHANGES.txt
===================================================================
--- /main/waeup.kofa/trunk/CHANGES.txt	(revision 12189)
+++ /main/waeup.kofa/trunk/CHANGES.txt	(revision 12190)
@@ -4,4 +4,6 @@
 1.3dev (unreleased)
 ===================
+
+* UserProcessor: Check if imported roles do exist in the portal.
 
 * Enable localization of batch processing modules.
Index: /main/waeup.kofa/trunk/src/waeup/kofa/authentication.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/authentication.py	(revision 12189)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/authentication.py	(revision 12190)
@@ -40,4 +40,5 @@
     IBatchProcessor, IGNORE_MARKER, IFailedLoginInfo)
 from waeup.kofa.utils.batching import BatchProcessor
+from waeup.kofa.permissions import get_all_roles
 
 def setup_authentication(pau):
@@ -513,4 +514,19 @@
         return
 
+    def checkConversion(self, row, mode='ignore'):
+        """Validates all values in row.
+        """
+        errs, inv_errs, conv_dict = super(
+            UserProcessor, self).checkConversion(row, mode=mode)
+        # We need to check if roles exist.
+        roles = row.get('roles', None)
+        all_roles = [i[0] for i in get_all_roles()]
+        if roles not in ('', IGNORE_MARKER):
+            evalvalue = eval(roles)
+            for role in evalvalue:
+                if role not in all_roles:
+                    errs.append(('roles','invalid role'))
+        return errs, inv_errs, conv_dict
+
 class UsersPlugin(grok.GlobalUtility):
     """A plugin that updates users.
Index: /main/waeup.kofa/trunk/src/waeup/kofa/browser/batchprocessing.txt
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/browser/batchprocessing.txt	(revision 12189)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/browser/batchprocessing.txt	(revision 12190)
@@ -430,4 +430,5 @@
     ... uli,Uli Fouquet,Chief Developer,uli@abc.de,+49-234-567,[]
     ... henrik,Henrik Bettermann,Admin,henrik@abc.de,+49-234-567,"['waeup.PortalManager', 'waeup.ImportManager']"
+    ... anne,Anne Palina,,anne@abc.de,+49-234-567,"['waeup.Nonsense']"
     ... """)
 
@@ -619,13 +620,23 @@
     ...
 
+Oh no, we forgot Anne Palina. Her user record was not imported because
+she has a non-existent role:
+
     >>> sorted(os.listdir(dc_path))
-    ['deleted', 'finished', 'logs', 'unfinished']
+    ['deleted', 'finished', 'logs', 'unfinished', 'users_zope.mgr.create.pending.csv']
 
     >>> os.listdir(dc_path + '/unfinished')
-    []
+    ['users_zope.mgr.csv']
+
+    >>> pending_file = dc_path + '/users_zope.mgr.create.pending.csv'
+    >>> print open(pending_file).read()
+    name,roles,title,public_name,phone,email,--ERRORS--
+    anne,['waeup.Nonsense'],Anne Palina,,+49-234-567,anne@abc.de,roles: invalid role
+
+There are many finished-files:
 
     >>> sorted(os.listdir(dc_path + '/finished'))
     ['certificates_zope.mgr.create.finished.csv', ...,
-    'users_zope.mgr.create.finished.csv', 'users_zope.mgr.csv']
+    'users_zope.mgr.create.finished.csv']
 
 Processed (finished) Files
