Modifying users to work with new concept

https://fedorahosted.org/freeipa/ticket/2040
This commit is contained in:
Petr Vobornik
2011-11-22 18:05:58 +01:00
committed by Endi S. Dewata
parent 5b26a383ce
commit b55d154375

View File

@@ -79,12 +79,11 @@ IPA.user.entity = function(spec) {
{ {
name: 'contact', name: 'contact',
fields: [ fields: [
{ factory: IPA.multivalued_text_widget, name: 'mail' }, { type: 'multivalued', name: 'mail' },
{ factory: IPA.multivalued_text_widget, name: 'telephonenumber' }, { type: 'multivalued', name: 'telephonenumber' },
{ factory: IPA.multivalued_text_widget, name: 'pager' }, { type: 'multivalued', name: 'pager' },
{ factory: IPA.multivalued_text_widget, name: 'mobile' }, { type: 'multivalued', name: 'mobile' },
{ factory: IPA.multivalued_text_widget, { type: 'multivalued', name: 'facsimiletelephonenumber' }
name: 'facsimiletelephonenumber' }
] ]
}, },
{ {
@@ -93,10 +92,10 @@ IPA.user.entity = function(spec) {
}, },
{ {
name: 'employee', name: 'employee',
fields: fields: [
['ou', 'ou',
{ {
factory:IPA.entity_select_widget, type: 'entity_select',
name: 'manager', name: 'manager',
other_entity: 'user', other_entity: 'user',
other_field: 'uid' other_field: 'uid'
@@ -207,7 +206,8 @@ IPA.user_status_widget = function(spec) {
spec = spec || {}; spec = spec || {};
var that = IPA.widget(spec); var that = IPA.input_widget(spec);
that.create = function(container) { that.create = function(container) {
@@ -249,12 +249,13 @@ IPA.user_status_widget = function(spec) {
}).appendTo(that.link_span); }).appendTo(that.link_span);
}; };
that.update = function() { that.update = function(values) {
if (!that.record) return; //if (!that.record) return;
var lock_field = 'nsaccountlock'; //var lock_field = 'nsaccountlock';
var locked_field = that.record[lock_field]; //var locked_field = that.record[lock_field];
var locked_field = values;
var locked = false; var locked = false;
if (locked_field instanceof Array) { if (locked_field instanceof Array) {
@@ -356,6 +357,10 @@ IPA.user_status_widget = function(spec) {
}).execute(); }).execute();
}; };
that.widgets_created = function() {
that.widget = that;
};
return that; return that;
}; };
@@ -363,7 +368,7 @@ IPA.user_password_widget = function(spec) {
spec = spec || {}; spec = spec || {};
var that = IPA.widget(spec); var that = IPA.input_widget(spec);
that.create = function(container) { that.create = function(container) {
@@ -385,30 +390,41 @@ IPA.user_password_widget = function(spec) {
that.pkey = IPA.nav.get_state('user-pkey'); that.pkey = IPA.nav.get_state('user-pkey');
that.self_service = that.pkey === IPA.whoami.uid[0]; that.self_service = that.pkey === IPA.whoami.uid[0];
var dialog = IPA.dialog({ var sections = [];
title: IPA.messages.password.reset_password, if(that.self_service) {
width: 400 sections.push({
}); fields: [
{
if (that.self_service) {
dialog.add_field(IPA.text_widget({
name: 'current_password', name: 'current_password',
label: IPA.messages.password.current_password, label: IPA.messages.password.current_password,
type: 'password' type: 'password'
})); }
]
});
} }
dialog.add_field(IPA.text_widget({ sections.push({
fields: [
{
name: 'password1', name: 'password1',
label: IPA.messages.password.new_password, label: IPA.messages.password.new_password,
type: 'password' type: 'password'
})); },
{
dialog.add_field(IPA.text_widget({
name: 'password2', name: 'password2',
label: IPA.messages.password.verify_password, label: IPA.messages.password.verify_password,
type: 'password' type: 'password'
})); }
]
});
var dialog = IPA.dialog({
entity: that.entity,
title: IPA.messages.password.reset_password,
width: 400,
sections: sections
});
dialog.create_button({ dialog.create_button({
name: 'reset_password', name: 'reset_password',