mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 15:40:01 -06:00
webui: control sudo rule deny command tables by category switch
`memberdenycmd_sudocmd` and `memberdenycmd_sudocmdgroup` tables are now enabled/disabled based on `cmdcategory` as well. https://fedorahosted.org/freeipa/ticket/4361 Reviewed-By: Nathaniel McCallum <npmccallum@redhat.com>
This commit is contained in:
parent
f0c19f907e
commit
f1b83198da
@ -43,9 +43,10 @@ IPA.rule_details_widget = function(spec) {
|
|||||||
|
|
||||||
that.init = function() {
|
that.init = function() {
|
||||||
|
|
||||||
that.enable_radio = IPA.radio_widget({
|
that.enable_radio = IPA.rule_radio_widget({
|
||||||
name: that.radio_name,
|
name: that.radio_name,
|
||||||
options: that.options
|
options: that.options,
|
||||||
|
entity: that.entity
|
||||||
});
|
});
|
||||||
|
|
||||||
that.widgets.add_widget(that.enable_radio);
|
that.widgets.add_widget(that.enable_radio);
|
||||||
@ -65,41 +66,38 @@ IPA.rule_details_widget = function(spec) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.init();
|
||||||
|
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rule radio widget
|
||||||
|
*
|
||||||
|
* Intended to be used especially by rule widget.
|
||||||
|
*
|
||||||
|
* @class IPA.rule_radio_widget
|
||||||
|
* @extends IPA.radio_widget
|
||||||
|
*/
|
||||||
|
IPA.rule_radio_widget = function(spec) {
|
||||||
|
|
||||||
|
spec = spec || {};
|
||||||
|
var that = IPA.radio_widget(spec);
|
||||||
|
|
||||||
|
/** @inheritDoc */
|
||||||
that.create = function(container) {
|
that.create = function(container) {
|
||||||
|
|
||||||
that.container = container;
|
var param_info = IPA.get_entity_param(that.entity.name, that.name);
|
||||||
|
var title = param_info ? param_info.doc : that.name;
|
||||||
|
|
||||||
//enable radios
|
container.append(title + ': ');
|
||||||
var param_info = IPA.get_entity_param(that.entity.name, that.radio_name);
|
that.widget_create(container);
|
||||||
var title = param_info ? param_info.doc : that.radio_name;
|
that.owb_create(container);
|
||||||
var enable_radio_container = $('<div/>', {
|
if (that.undo) {
|
||||||
name: that.radio_name,
|
that.create_undo(container);
|
||||||
title: title,
|
|
||||||
'class': 'field'
|
|
||||||
}).appendTo(container);
|
|
||||||
|
|
||||||
enable_radio_container.append(title+': ');
|
|
||||||
that.enable_radio.create(enable_radio_container);
|
|
||||||
|
|
||||||
//tables
|
|
||||||
for (var j=0; j<that.tables.length; j++) {
|
|
||||||
var table = that.tables[j];
|
|
||||||
|
|
||||||
var metadata = IPA.get_entity_param(that.entity.name, table.name);
|
|
||||||
|
|
||||||
var table_container = $('<div/>', {
|
|
||||||
name: table.name,
|
|
||||||
title: metadata ? metadata.doc : table.name,
|
|
||||||
'class': 'field'
|
|
||||||
}).appendTo(container);
|
|
||||||
|
|
||||||
var widget = that.widgets.get_widget(table.name);
|
|
||||||
widget.create(table_container);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
that.init();
|
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -460,13 +460,13 @@ var add_sudorule_details_facet_widgets = function (spec) {
|
|||||||
{
|
{
|
||||||
$type: 'rule_association_table',
|
$type: 'rule_association_table',
|
||||||
name: 'memberdenycmd_sudocmd',
|
name: 'memberdenycmd_sudocmd',
|
||||||
widget: 'command.memberdenycmd_sudocmd',
|
widget: 'command.rule.memberdenycmd_sudocmd',
|
||||||
priority: IPA.sudo.remove_method_priority
|
priority: IPA.sudo.remove_method_priority
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
$type: 'rule_association_table',
|
$type: 'rule_association_table',
|
||||||
name: 'memberdenycmd_sudocmdgroup',
|
name: 'memberdenycmd_sudocmdgroup',
|
||||||
widget: 'command.memberdenycmd_sudocmdgroup',
|
widget: 'command.rule.memberdenycmd_sudocmdgroup',
|
||||||
priority: IPA.sudo.remove_method_priority
|
priority: IPA.sudo.remove_method_priority
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -477,12 +477,6 @@ var add_sudorule_details_facet_widgets = function (spec) {
|
|||||||
name: 'command',
|
name: 'command',
|
||||||
label: '@i18n:objects.sudorule.command',
|
label: '@i18n:objects.sudorule.command',
|
||||||
widgets: [
|
widgets: [
|
||||||
{
|
|
||||||
$factory: IPA.header_widget,
|
|
||||||
name: 'allow_header',
|
|
||||||
text: '@i18n:objects.sudorule.allow',
|
|
||||||
description: '@i18n:objects.sudorule.allow'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
$factory: IPA.rule_details_widget,
|
$factory: IPA.rule_details_widget,
|
||||||
name: 'rule',
|
name: 'rule',
|
||||||
@ -499,9 +493,17 @@ var add_sudorule_details_facet_widgets = function (spec) {
|
|||||||
],
|
],
|
||||||
tables: [
|
tables: [
|
||||||
{ name: 'memberallowcmd_sudocmd' },
|
{ name: 'memberallowcmd_sudocmd' },
|
||||||
{ name: 'memberallowcmd_sudocmdgroup' }
|
{ name: 'memberallowcmd_sudocmdgroup' },
|
||||||
|
{ name: 'memberdenycmd_sudocmd' },
|
||||||
|
{ name: 'memberdenycmd_sudocmdgroup' }
|
||||||
],
|
],
|
||||||
widgets: [
|
widgets: [
|
||||||
|
{
|
||||||
|
$factory: IPA.header_widget,
|
||||||
|
name: 'allow_header',
|
||||||
|
text: '@i18n:objects.sudorule.allow',
|
||||||
|
description: '@i18n:objects.sudorule.allow'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
$type: 'rule_association_table',
|
$type: 'rule_association_table',
|
||||||
id: 'sudorule-memberallowcmd_sudocmd',
|
id: 'sudorule-memberallowcmd_sudocmd',
|
||||||
@ -519,32 +521,32 @@ var add_sudorule_details_facet_widgets = function (spec) {
|
|||||||
remove_method: 'remove_allow_command',
|
remove_method: 'remove_allow_command',
|
||||||
add_title: '@i18n:association.add.memberallowcmd',
|
add_title: '@i18n:association.add.memberallowcmd',
|
||||||
remove_title: '@i18n:association.remove.memberallowcmd'
|
remove_title: '@i18n:association.remove.memberallowcmd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$factory: IPA.header_widget,
|
||||||
|
name: 'deny_header',
|
||||||
|
text: '@i18n:objects.sudorule.deny',
|
||||||
|
description: '@i18n:objects.sudorule.deny'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$type: 'rule_association_table',
|
||||||
|
id: 'sudorule-memberdenycmd_sudocmd',
|
||||||
|
name: 'memberdenycmd_sudocmd',
|
||||||
|
add_method: 'add_deny_command',
|
||||||
|
remove_method: 'remove_deny_command',
|
||||||
|
add_title: '@i18n:association.add.memberdenycmd',
|
||||||
|
remove_title: '@i18n:association.remove.memberdenycmd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$type: 'rule_association_table',
|
||||||
|
id: 'sudorule-memberdenycmd_sudocmdgroup',
|
||||||
|
name: 'memberdenycmd_sudocmdgroup',
|
||||||
|
add_method: 'add_deny_command',
|
||||||
|
remove_method: 'remove_deny_command',
|
||||||
|
add_title: '@i18n:association.add.memberdenycmd',
|
||||||
|
remove_title: '@i18n:association.remove.memberdenycmd'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
$factory: IPA.header_widget,
|
|
||||||
name: 'deny_header',
|
|
||||||
text: '@i18n:objects.sudorule.deny',
|
|
||||||
description: '@i18n:objects.sudorule.deny'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$type: 'rule_association_table',
|
|
||||||
id: 'sudorule-memberdenycmd_sudocmd',
|
|
||||||
name: 'memberdenycmd_sudocmd',
|
|
||||||
add_method: 'add_deny_command',
|
|
||||||
remove_method: 'remove_deny_command',
|
|
||||||
add_title: '@i18n:association.add.memberdenycmd',
|
|
||||||
remove_title: '@i18n:association.remove.memberdenycmd'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$type: 'rule_association_table',
|
|
||||||
id: 'sudorule-memberdenycmd_sudocmdgroup',
|
|
||||||
name: 'memberdenycmd_sudocmdgroup',
|
|
||||||
add_method: 'add_deny_command',
|
|
||||||
remove_method: 'remove_deny_command',
|
|
||||||
add_title: '@i18n:association.add.memberdenycmd',
|
|
||||||
remove_title: '@i18n:association.remove.memberdenycmd'
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,8 @@ class test_sudo(UI_driver):
|
|||||||
self.delete(group.ENTITY, [group.DATA, group.DATA2])
|
self.delete(group.ENTITY, [group.DATA, group.DATA2])
|
||||||
self.delete(HOST_ENTITY, [host.data, host.data2])
|
self.delete(HOST_ENTITY, [host.data, host.data2])
|
||||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA, hostgroup.DATA2])
|
self.delete(hostgroup.ENTITY, [hostgroup.DATA, hostgroup.DATA2])
|
||||||
|
self.delete(sudo.CMDENTITY, [sudo.CMD_DATA, sudo.CMD_DATA2])
|
||||||
|
self.delete(sudo.CMDGROUP_ENTITY, [sudo.CMDGROUP_DATA, sudo.CMDGROUP_DATA2])
|
||||||
|
|
||||||
@screenshot
|
@screenshot
|
||||||
def test_actions(self):
|
def test_actions(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user