--- a/src/pyams_security/zmi/plugin/userfolder.py Sat Feb 28 15:25:05 2015 +0100
+++ b/src/pyams_security/zmi/plugin/userfolder.py Sat Feb 28 15:26:27 2015 +0100
@@ -93,6 +93,15 @@
return absolute_url(self.context, self.request, 'security-manager.html')
+@subscriber(IDataExtractedEvent, form_selector=UsersFolderAddForm)
+def handle_new_user_folder_data_extraction(event):
+ """Handle new user folder form data extraction"""
+ manager = query_utility(ISecurityManager)
+ prefix = event.data.get('prefix')
+ if prefix in manager:
+ event.form.widgets.errors += (Invalid(_("Specified prefix is already used!")),)
+
+
@view_config(name='add-users-folder.json', context=ISite, request_type=IPyAMSLayer,
permission='system.manage', renderer='json', xhr=True)
class UsersFolderAJAXAddForm(AJAXAddForm, UsersFolderAddForm):