278 |
278 |
return AdminIDPUI(component)
|
279 |
279 |
|
280 |
280 |
@classmethod
|
|
281 |
def user_fields_options(self):
|
|
282 |
'''List user formdef fields for the SelectWidget of the attribute
|
|
283 |
mapping setting'''
|
|
284 |
UserClass = get_publisher().user_class
|
|
285 |
options = []
|
|
286 |
for field in UserClass.get_formdef().fields:
|
|
287 |
options.append((str(field.id), field.label))
|
|
288 |
return options
|
|
289 |
|
|
290 |
@classmethod
|
281 |
291 |
def get_form(cls, instance={}):
|
282 |
292 |
form = Form(enctype='multipart/form-data')
|
283 |
293 |
form.add(FileWidget, 'metadata', title = _('Metadata'), required=not instance)
|
... | ... | |
295 |
305 |
hint=_('First row match attribute names, second is for matching '
|
296 |
306 |
'attribute value. If no rule is given, admin flag is never '
|
297 |
307 |
'set. Flag is set if any rule match.'))
|
|
308 |
options = cls.user_fields_options()
|
|
309 |
form.add(WidgetDict, 'attribute-mapping',
|
|
310 |
value=instance.get('attribute-mapping', {}),
|
|
311 |
title=_('Attribute mapping'),
|
|
312 |
element_value_type=SingleSelectWidget,
|
|
313 |
element_value_kwargs={'options': options},
|
|
314 |
hint=_('First row match attribute names, second is regexp for matching attribute value'))
|
298 |
315 |
form.add_submit('submit', _('Submit'))
|
299 |
316 |
return form
|
300 |
317 |
|
... | ... | |
360 |
377 |
'cacertchain': cacertchain_fn,
|
361 |
378 |
'clientcertificate': clientcertificate_fn,
|
362 |
379 |
}
|
363 |
|
for key in ('hide', 'admin-attributes'):
|
|
380 |
for key in ('hide', 'admin-attributes', 'attribute-mapping'):
|
364 |
381 |
cfg_idp[key_provider_id][key] = form.get_widget(key).parse()
|
365 |
382 |
idp = cfg_idp[key_provider_id]
|
366 |
383 |
p = lasso.Provider(lasso.PROVIDER_ROLE_IDP,
|
367 |
|
-
|