WebUI: Unify adapter property definition for state evaluators

Move adapter property definition to IPA.state_evaluator since it
is used by all evaluators

Related: https://pagure.io/freeipa/issue/8336
Reviewed-By: Alexander Bokovoy <abbra@users.noreply.github.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
Peter Keresztes Schmidt 2020-05-29 18:11:45 +02:00 committed by Florence Blanc-Renaud
parent df5526fbc7
commit 2d87cd4ae1
4 changed files with 7 additions and 14 deletions

View File

@ -1536,8 +1536,6 @@ exp.boolean_state_evaluator = IPA.boolean_state_evaluator = function(spec) {
that.param = spec.param || that.field_name; that.param = spec.param || that.field_name;
that.adapter = builder.build('adapter', spec.adapter || 'adapter', { context: that });
/** /**
* State to set when value is `true` * State to set when value is `true`
* @property {string} * @property {string}
@ -1643,8 +1641,6 @@ exp.acl_state_evaluator = IPA.acl_state_evaluator = function(spec) {
that.param = spec.param || 'attributelevelrights'; that.param = spec.param || 'attributelevelrights';
that.adapter = builder.build('adapter', spec.adapter || 'adapter', { context: that });
/** /**
* @inheritDoc * @inheritDoc
*/ */
@ -1687,7 +1683,6 @@ exp.value_state_evaluator = IPA.value_state_evaluator = function(spec) {
spec.name = spec.name || 'value_state_evaluator'; spec.name = spec.name || 'value_state_evaluator';
spec.event = spec.event || 'post_load'; spec.event = spec.event || 'post_load';
spec.adapter = spec.adapter || {};
var that = IPA.state_evaluator(spec); var that = IPA.state_evaluator(spec);
@ -1712,9 +1707,6 @@ exp.value_state_evaluator = IPA.value_state_evaluator = function(spec) {
*/ */
that.representation = spec.representation; that.representation = spec.representation;
that.adapter = builder.build('adapter',
spec.adapter, { context: that });
that.param = spec.param; that.param = spec.param;
/** /**
@ -1798,7 +1790,6 @@ exp.has_keytab_evaluator = IPA.has_keytab_evaluator = function(spec) {
spec.value = spec.value || [true]; spec.value = spec.value || [true];
spec.representation = spec.representation || 'has_keytab'; spec.representation = spec.representation || 'has_keytab';
spec.param = spec.param || 'has_keytab'; spec.param = spec.param || 'has_keytab';
spec.adapter = spec.adapter || { $type: 'adapter' };
var that = IPA.value_state_evaluator(spec); var that = IPA.value_state_evaluator(spec);
@ -1823,8 +1814,6 @@ exp.object_class_evaluator = IPA.object_class_evaluator = function(spec) {
var that = IPA.state_evaluator(spec); var that = IPA.state_evaluator(spec);
that.adapter = builder.build('adapter', spec.adapter || 'adapter', { context: that });
/** /**
* @inheritDoc * @inheritDoc
*/ */

View File

@ -3187,6 +3187,13 @@ exp.state_evaluator = IPA.state_evaluator = function(spec) {
*/ */
that.first_pass = true; that.first_pass = true;
/**
* Adapter which selects values from record on load.
*
* @property {IPA.Adapter}
*/
that.adapter = builder.build('adapter', spec.adapter || 'adapter', { context: that });
/** /**
* Init the evaluator * Init the evaluator
* *

View File

@ -1105,7 +1105,6 @@ IPA.host.has_password_evaluator = function(spec) {
spec.value = spec.value || [true]; spec.value = spec.value || [true];
spec.representation = spec.representation || 'has_password'; spec.representation = spec.representation || 'has_password';
spec.param = spec.param || 'has_password'; spec.param = spec.param || 'has_password';
spec.adapter = spec.adapter || { $type: 'adapter' };
var that = IPA.value_state_evaluator(spec); var that = IPA.value_state_evaluator(spec);

View File

@ -948,7 +948,6 @@ IPA.user.self_service_other_user_evaluator = function(spec) {
var that = IPA.state_evaluator(spec); var that = IPA.state_evaluator(spec);
that.name = spec.name || 'self_service_other_user_evaluator'; that.name = spec.name || 'self_service_other_user_evaluator';
that.param = spec.param || 'uid'; that.param = spec.param || 'uid';
that.adapter = builder.build('adapter', spec.adapter || 'adapter', { context: that });
/** /**
* Evaluates if user is in self-service and viewing himself * Evaluates if user is in self-service and viewing himself
@ -982,7 +981,6 @@ IPA.user.preserved_user_evaluator = function(spec) {
var that = IPA.state_evaluator(spec); var that = IPA.state_evaluator(spec);
that.name = spec.name || 'preserved_user_evaluator'; that.name = spec.name || 'preserved_user_evaluator';
that.param = spec.param || 'dn'; that.param = spec.param || 'dn';
that.adapter = builder.build('adapter', { $type: 'adapter'}, { context: that });
/** /**
* Evaluates if user is preserved, i.e. is in provisioning tree * Evaluates if user is preserved, i.e. is in provisioning tree