mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed displaying of external records in rule association widgets
It's a fix for regression introduced by widget refactoring #2040. https://fedorahosted.org/freeipa/ticket/2040
This commit is contained in:
committed by
Endi S. Dewata
parent
cb649f2de2
commit
187bedafd0
@@ -305,6 +305,8 @@ IPA.association_table_widget = function (spec) {
|
||||
|
||||
that.adder_columns = $.ordered_map();
|
||||
|
||||
that.needs_refresh = IPA.observer();
|
||||
|
||||
that.get_adder_column = function(name) {
|
||||
return that.adder_columns.get(name);
|
||||
};
|
||||
@@ -644,24 +646,7 @@ IPA.association_table_widget = function (spec) {
|
||||
|
||||
that.refresh = function() {
|
||||
|
||||
function on_success(data, text_status, xhr) {
|
||||
that.load(data.result.result);
|
||||
}
|
||||
|
||||
function on_error(xhr, text_status, error_thrown) {
|
||||
var summary = $('span[name=summary]', that.tfoot).empty();
|
||||
summary.append(error_thrown.name+': '+error_thrown.message);
|
||||
}
|
||||
|
||||
var pkey = IPA.nav.get_state(that.entity.name+'-pkey');
|
||||
IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'show',
|
||||
args: [pkey],
|
||||
options: { all: true, rights: true },
|
||||
on_success: on_success,
|
||||
on_error: on_error
|
||||
}).execute();
|
||||
that.needs_refresh.notify([], that);
|
||||
};
|
||||
|
||||
/*initialization code*/
|
||||
@@ -687,6 +672,45 @@ IPA.association_table_widget = function (spec) {
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.association_table_field = function (spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
var that = IPA.field(spec);
|
||||
|
||||
that.refresh = function() {
|
||||
|
||||
function on_success(data, text_status, xhr) {
|
||||
that.load(data.result.result);
|
||||
}
|
||||
|
||||
function on_error(xhr, text_status, error_thrown) {
|
||||
that.widget.summary.text(error_thrown.name+': '+error_thrown.message);
|
||||
}
|
||||
|
||||
var pkey = IPA.nav.get_state(that.entity.name+'-pkey');
|
||||
IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'show',
|
||||
args: [pkey],
|
||||
options: { all: true, rights: true },
|
||||
on_success: on_success,
|
||||
on_error: on_error
|
||||
}).execute();
|
||||
};
|
||||
|
||||
that.widgets_created = function() {
|
||||
|
||||
that.field_widgets_created();
|
||||
that.widget.needs_refresh.attach(that.refresh);
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.widget_factories['association_table'] = IPA.association_table_widget;
|
||||
IPA.field_factories['association_table'] = IPA.association_table_field;
|
||||
|
||||
|
||||
IPA.association_facet = function (spec) {
|
||||
|
||||
|
@@ -134,10 +134,14 @@ IPA.rule_association_table_field = function(spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
var that = IPA.field(spec);
|
||||
var that = IPA.association_table_field(spec);
|
||||
|
||||
that.external = spec.external;
|
||||
|
||||
|
||||
that.load = function(result) {
|
||||
that.values = result[that.name] || [];
|
||||
|
||||
if (that.external) {
|
||||
var external_values = result[that.external] || [];
|
||||
$.merge(that.values, external_values);
|
||||
|
@@ -278,6 +278,7 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
type: 'rule_association_table',
|
||||
name: 'memberuser_user',
|
||||
widget: 'user.rule.memberuser_user',
|
||||
external: 'externaluser',
|
||||
priority: IPA.sudo.remove_method_priority
|
||||
},
|
||||
{
|
||||
@@ -352,6 +353,7 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
type: 'rule_association_table',
|
||||
name: 'memberhost_host',
|
||||
widget: 'host.rule.memberhost_host',
|
||||
external: 'externalhost',
|
||||
priority: IPA.sudo.remove_method_priority
|
||||
},
|
||||
{
|
||||
@@ -541,6 +543,7 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
type: 'rule_association_table',
|
||||
name: 'ipasudorunas_user',
|
||||
widget: 'runas.runas_users.ipasudorunas_user',
|
||||
external: 'ipasudorunasextuser',
|
||||
priority: IPA.sudo.remove_method_priority
|
||||
},
|
||||
{
|
||||
@@ -558,6 +561,7 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
type: 'rule_association_table',
|
||||
name: 'ipasudorunasgroup_group',
|
||||
widget: 'runas.runas_groups.ipasudorunasgroup_group',
|
||||
external: 'ipasudorunasextgroup',
|
||||
priority: IPA.sudo.remove_method_priority
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user