WebUI: Disable 'Unlock' action for users with no password

Administrator should reset user password to make the unlock option available.

Ticket: https://pagure.io/freeipa/issue/5062

Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Serhii Tsymbaliuk 2019-06-27 12:51:33 +02:00
parent 6b2efdfae5
commit 93dc2d569d
No known key found for this signature in database
GPG Key ID: 632C7F5C1BC85519

View File

@ -407,6 +407,7 @@ return {
label: '@i18n:objects.user.unlock',
needs_confirm: true,
hide_cond: ['preserved-user'],
disable_cond: ['no-password'],
confirm_msg: '@i18n:objects.user.unlock_confirm'
},
{
@ -442,6 +443,7 @@ return {
},
IPA.user.self_service_other_user_evaluator,
IPA.user.preserved_user_evaluator,
IPA.user.no_password_evaluator,
IPA.cert.certificate_evaluator
],
summary_conditions: [
@ -1078,6 +1080,35 @@ IPA.user.deleter_dialog = function(spec) {
return that;
};
IPA.user.no_password_evaluator = function(spec) {
spec = spec || {};
spec.event = spec.event || 'post_load';
var that = IPA.state_evaluator(spec);
that.name = spec.name || 'no_password_evaluator';
that.param = spec.param || 'has_password';
that.adapter = builder.build('adapter', { $type: 'adapter'}, { context: that });
/**
* Evaluates if user has no password
*/
that.on_event = function(data) {
var old_state = that.state;
that.state = [];
var has_password = that.adapter.load(data)[0];
if (!has_password) {
that.state.push('no-password');
}
that.notify_on_change(old_state);
};
return that;
};
exp.entity_spec = make_spec();
exp.register = function() {
var e = reg.entity;