summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-08-22 15:06:00 -0500
committerEndi S. Dewata <edewata@redhat.com>2011-08-23 22:23:31 +0000
commitffebf3763917b13b945fb27b8da3d524d833162e (patch)
tree5413a23cc455a73e9d33a9a9c3a00d931be47b9e
parentc4f04dd858a43ccdeb83216b442e44298af25090 (diff)
downloadfreeipa-ffebf3763917b13b945fb27b8da3d524d833162e.tar.gz
freeipa-ffebf3763917b13b945fb27b8da3d524d833162e.tar.xz
freeipa-ffebf3763917b13b945fb27b8da3d524d833162e.zip
Removed unnecessary HBAC/sudo rule category modification.
Since the Add/Delete links in the association table are disabled when the category is set to 'all', it's no longer necessary to check the category before showing the add/delete dialogs and modify the category before adding entries. Thus, the IPA.rule_association_table_widget is no longer needed. Ticket #1692
-rw-r--r--install/ui/association.js29
-rw-r--r--install/ui/hbac.js32
-rw-r--r--install/ui/ipa.css11
-rw-r--r--install/ui/rule.js66
-rw-r--r--install/ui/search.js9
-rw-r--r--install/ui/sudo.js27
6 files changed, 40 insertions, 134 deletions
diff --git a/install/ui/association.js b/install/ui/association.js
index 4ee36934d..b79a18f06 100644
--- a/install/ui/association.js
+++ b/install/ui/association.js
@@ -350,32 +350,32 @@ IPA.association_table_widget = function (spec) {
that.table_create(container);
- var button = IPA.action_button({
+ var remove_button = IPA.action_button({
name: 'remove',
label: IPA.messages.buttons.remove,
icon: 'remove-icon',
click: function() {
- that.remove_handler();
+ if (!remove_button.hasClass('action-button-disabled')) {
+ that.remove_handler();
+ }
return false;
}
}).appendTo(that.buttons);
- button = IPA.action_button({
+ var add_button = IPA.action_button({
name: 'add',
label: IPA.messages.buttons.add,
icon: 'add-icon',
click: function() {
- that.add_handler();
+ if (!add_button.hasClass('action-button-disabled')) {
+ that.add_handler();
+ }
return false;
}
}).appendTo(that.buttons);
};
that.add_handler = function() {
- if ($(this).hasClass('action-button-disabled')) {
- return;
- }
-
var facet = that.entity.get_facet();
if (facet.is_dirty()) {
@@ -396,10 +396,6 @@ IPA.association_table_widget = function (spec) {
};
that.remove_handler = function() {
- if ($(this).hasClass('action-button-disabled')) {
- return;
- }
-
var facet = that.entity.get_facet();
if (facet.is_dirty()) {
@@ -838,7 +834,6 @@ IPA.association_facet = function (spec) {
that.facet_create_header(container);
that.pkey = IPA.nav.get_state(that.entity.name+'-pkey');
- var other_label = IPA.metadata.objects[that.other_entity].label;
if (!that.read_only) {
that.remove_button = IPA.action_button({
@@ -846,7 +841,9 @@ IPA.association_facet = function (spec) {
label: IPA.messages.buttons.remove,
icon: 'remove-icon',
click: function() {
- that.show_remove_dialog();
+ if (!that.remove_button.hasClass('action-button-disabled')) {
+ that.show_remove_dialog();
+ }
return false;
}
}).appendTo(that.controls);
@@ -856,7 +853,9 @@ IPA.association_facet = function (spec) {
label: IPA.messages.buttons.enroll,
icon: 'add-icon',
click: function() {
- that.show_add_dialog();
+ if (!that.add_button.hasClass('action-button-disabled')) {
+ that.show_add_dialog();
+ }
return false;
}
}).appendTo(that.controls);
diff --git a/install/ui/hbac.js b/install/ui/hbac.js
index 274c52d68..3223e0f31 100644
--- a/install/ui/hbac.js
+++ b/install/ui/hbac.js
@@ -181,22 +181,20 @@ IPA.hbacrule_details_facet = function(spec) {
]
});
- var category = section.add_field(IPA.radio_widget({
+ section.add_field(IPA.radio_widget({
name: 'usercategory'
}));
- section.add_field(IPA.rule_association_table_widget({
+ section.add_field(IPA.association_table_widget({
id: that.entity.name+'-memberuser_user',
name: 'memberuser_user',
- category: category,
add_method: 'add_user',
remove_method: 'remove_user',
add_title: IPA.messages.association.add.member,
remove_title: IPA.messages.association.remove.member
}));
- section.add_field(IPA.rule_association_table_widget({
+ section.add_field(IPA.association_table_widget({
id: that.entity.name+'-memberuser_group',
name: 'memberuser_group',
- category: category,
add_method: 'add_user',
remove_method: 'remove_user',
add_title: IPA.messages.association.add.member,
@@ -222,22 +220,20 @@ IPA.hbacrule_details_facet = function(spec) {
]
});
- var category = section.add_field(IPA.radio_widget({
+ section.add_field(IPA.radio_widget({
name: 'hostcategory'
}));
- section.add_field(IPA.rule_association_table_widget({
+ section.add_field(IPA.association_table_widget({
id: that.entity.name+'-memberhost_host',
name: 'memberhost_host',
- category: category,
add_method: 'add_host',
remove_method: 'remove_host',
add_title: IPA.messages.association.add.member,
remove_title: IPA.messages.association.remove.member
}));
- section.add_field(IPA.rule_association_table_widget({
+ section.add_field(IPA.association_table_widget({
id: that.entity.name+'-memberhost_hostgroup',
name: 'memberhost_hostgroup',
- category: category,
add_method: 'add_host',
remove_method: 'remove_host',
add_title: IPA.messages.association.add.member,
@@ -264,22 +260,20 @@ IPA.hbacrule_details_facet = function(spec) {
]
});
- var category = section.add_field(IPA.radio_widget({
+ section.add_field(IPA.radio_widget({
name: 'servicecategory'
}));
- section.add_field(IPA.rule_association_table_widget({
+ section.add_field(IPA.association_table_widget({
id: that.entity.name+'-memberservice_hbacsvc',
name: 'memberservice_hbacsvc',
- category: category,
add_method: 'add_service',
remove_method: 'remove_service',
add_title: IPA.messages.association.add.member,
remove_title: IPA.messages.association.remove.member
}));
- section.add_field(IPA.rule_association_table_widget({
+ section.add_field(IPA.association_table_widget({
id: that.entity.name+'-memberservice_hbacsvcgroup',
name: 'memberservice_hbacsvcgroup',
- category: category,
add_method: 'add_service',
remove_method: 'remove_service',
add_title: IPA.messages.association.add.member,
@@ -305,22 +299,20 @@ IPA.hbacrule_details_facet = function(spec) {
]
});
- var category = section.add_field(IPA.radio_widget({
+ section.add_field(IPA.radio_widget({
name: 'sourcehostcategory'
}));
- section.add_field(IPA.rule_association_table_widget({
+ section.add_field(IPA.association_table_widget({
id: that.entity.name+'-sourcehost_host',
name: 'sourcehost_host',
- category: category,
add_method: 'add_sourcehost',
remove_method: 'remove_sourcehost',
add_title: IPA.messages.association.add.sourcehost,
remove_title: IPA.messages.association.remove.sourcehost
}));
- section.add_field(IPA.rule_association_table_widget({
+ section.add_field(IPA.association_table_widget({
id: that.entity.name+'-sourcehost_hostgroup',
name: 'sourcehost_hostgroup',
- category: category,
add_method: 'add_sourcehost',
remove_method: 'remove_sourcehost',
add_title: IPA.messages.association.add.sourcehost,
diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index 9f94d470b..705e9a11e 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -130,15 +130,6 @@ body {
cursor: pointer;
}
-.input_link_disabled {
- cursor: default;
- color:black;
-}
-
-.input_link_label {
-
-}
-
.icon {
display: inline-block;
height: 16px;
@@ -1034,7 +1025,7 @@ span.main-separator{
padding: 0 0.2em;
}
-a.action-button-disabled {
+.action-button-disabled {
color: gray;
cursor: default;
}
diff --git a/install/ui/rule.js b/install/ui/rule.js
index 44f037f16..d9602f689 100644
--- a/install/ui/rule.js
+++ b/install/ui/rule.js
@@ -104,69 +104,3 @@ IPA.rule_details_section = function(spec) {
return that;
};
-
-
-IPA.rule_association_table_widget = function(spec) {
-
- spec = spec || {};
-
- var that = IPA.association_table_widget(spec);
-
- that.category = spec.category;
-
- that.show_add_dialog = function() {
- if (that.category) {
- var values = that.category.save();
- if (values[0] !== '') return;
- }
- that.association_table_widget_show_add_dialog();
- };
-
- that.show_remove_dialog = function() {
- if (that.category) {
- var values = that.category.save();
- if (values[0] !== '') return;
- }
- that.association_table_widget_show_remove_dialog();
- };
-
- that.add = function(values, on_success, on_error) {
-
- var pkey = IPA.nav.get_state(that.entity.name+'-pkey');
-
- var batch = IPA.batch_command({
- 'on_success': on_success,
- 'on_error': on_error
- });
-
- var command;
-
- if (that.category) {
- command = IPA.command({
- entity: that.entity.name,
- method: 'mod',
- args: [pkey],
- options: {all: true, rights: true},
- on_success: function() {
- var record = {};
- record[that.category.name] = [''];
- that.category.load(record);
- }
- });
- command.set_option(that.category.name, '');
- batch.add_command(command);
- }
-
- command = IPA.command({
- entity: that.entity.name,
- method: that.add_method,
- args: [pkey]
- });
- command.set_option(that.other_entity, values.join(','));
- batch.add_command(command);
-
- batch.execute();
- };
-
- return that;
-};
diff --git a/install/ui/search.js b/install/ui/search.js
index 454ecf453..c469debc8 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -146,10 +146,9 @@ IPA.search_facet = function(spec) {
label: IPA.messages.buttons.remove,
icon: 'remove-icon',
click: function() {
- if (that.remove_button.hasClass('input_link_disabled')) {
- return false;
+ if (!that.remove_button.hasClass('action-button-disabled')) {
+ that.remove();
}
- that.remove();
return false;
}
}).appendTo(that.controls);
@@ -181,9 +180,9 @@ IPA.search_facet = function(spec) {
if (that.remove_button) {
if (values.length === 0) {
- that.remove_button.addClass('input_link_disabled');
+ that.remove_button.addClass('action-button-disabled');
} else {
- that.remove_button.removeClass('input_link_disabled');
+ that.remove_button.removeClass('action-button-disabled');
}
}
};
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index 375ca93ac..8d33550c0 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -180,7 +180,7 @@ IPA.sudorule_details_facet = function(spec) {
]
});
- var category = section.add_field(IPA.radio_widget({
+ section.add_field(IPA.radio_widget({
entity: that.entity,
name: 'usercategory'
}));
@@ -188,7 +188,6 @@ IPA.sudorule_details_facet = function(spec) {
id: that.entity.name+'-memberuser_user',
entity: that.entity,
name: 'memberuser_user',
- category: category,
add_method: 'add_user',
remove_method: 'remove_user',
external: 'externaluser',
@@ -199,7 +198,6 @@ IPA.sudorule_details_facet = function(spec) {
id: that.entity.name+'-memberuser_group',
entity: that.entity,
name: 'memberuser_group',
- category: category,
add_method: 'add_user',
remove_method: 'remove_user',
add_title: IPA.messages.association.add.member,
@@ -224,7 +222,7 @@ IPA.sudorule_details_facet = function(spec) {
]
});
- var category = section.add_field(IPA.radio_widget({
+ section.add_field(IPA.radio_widget({
entity: that.entity,
name: 'hostcategory'
}));
@@ -232,7 +230,6 @@ IPA.sudorule_details_facet = function(spec) {
id: that.entity.name+'-memberhost_host',
entity: that.entity,
name: 'memberhost_host',
- category: category,
add_method: 'add_host',
remove_method: 'remove_host',
external: 'externalhost',
@@ -243,7 +240,6 @@ IPA.sudorule_details_facet = function(spec) {
id: that.entity.name+'-memberhost_hostgroup',
entity: that.entity,
name: 'memberhost_hostgroup',
- category: category,
add_method: 'add_host',
remove_method: 'remove_host',
add_title: IPA.messages.association.add.member,
@@ -680,26 +676,24 @@ IPA.sudo.rule_details_command_section = function(spec) {
]
}));
- that.add_field(IPA.rule_association_table_widget({
+ that.add_field(IPA.association_table_widget({
id: that.entity.name+'-memberallowcmd_sudocmd',
name: 'memberallowcmd_sudocmd',
- category: that.category,
add_method: 'add_allow_command',
remove_method: 'remove_allow_command',
add_title: IPA.messages.association.add.memberallowcmd,
remove_title: IPA.messages.association.remove.memberallowcmd
}));
- that.add_field(IPA.rule_association_table_widget({
+ that.add_field(IPA.association_table_widget({
id: that.entity.name+'-memberallowcmd_sudocmdgroup',
name: 'memberallowcmd_sudocmdgroup',
- category: that.category,
add_method: 'add_allow_command',
remove_method: 'remove_allow_command',
add_title: IPA.messages.association.add.memberallowcmd,
remove_title: IPA.messages.association.remove.memberallowcmd
}));
- that.add_field(IPA.rule_association_table_widget({
+ that.add_field(IPA.association_table_widget({
id: that.entity.name+'-memberdenycmd_sudocmd',
name: 'memberdenycmd_sudocmd',
add_method: 'add_deny_command',
@@ -707,7 +701,7 @@ IPA.sudo.rule_details_command_section = function(spec) {
add_title: IPA.messages.association.add.memberdenycmd,
remove_title: IPA.messages.association.remove.memberdenycmd
}));
- that.add_field(IPA.rule_association_table_widget({
+ that.add_field(IPA.association_table_widget({
id: that.entity.name+'-memberdenycmd_sudocmdgroup',
name: 'memberdenycmd_sudocmdgroup',
add_method: 'add_deny_command',
@@ -834,7 +828,7 @@ IPA.sudo.rule_details_runas_section = function(spec) {
var that = IPA.details_section(spec);
function add_extra_fields(){
- var category = that.add_field(
+ that.add_field(
IPA.radio_widget({
name: 'ipasudorunasusercategory',
options:[
@@ -851,7 +845,6 @@ IPA.sudo.rule_details_runas_section = function(spec) {
that.add_field(IPA.sudorule_association_table_widget({
id: that.entity.name+'-runasruser_user',
name: 'ipasudorunas_user',
- category: category,
add_method: 'add_runasuser',
remove_method: 'remove_runasuser',
add_title: IPA.messages.association.add.ipasudorunas,
@@ -860,14 +853,13 @@ IPA.sudo.rule_details_runas_section = function(spec) {
that.add_field(IPA.sudorule_association_table_widget({
id: that.entity.name+'-runasuser_group',
name: 'ipasudorunas_group',
- category: category,
add_method: 'add_runasuser',
remove_method: 'remove_runasuser',
add_title: IPA.messages.association.add.ipasudorunas,
remove_title: IPA.messages.association.remove.ipasudorunas
}));
- category = that.add_field(
+ that.add_field(
IPA.radio_widget({
name: 'ipasudorunasgroupcategory',
options:[
@@ -885,7 +877,6 @@ IPA.sudo.rule_details_runas_section = function(spec) {
that.add_field(IPA.sudorule_association_table_widget({
id: that.entity.name+'-runasgroup_group',
name: 'ipasudorunasgroup_group',
- category: category,
add_method: 'add_runasgroup',
remove_method: 'remove_runasgroup',
add_title: IPA.messages.association.add.ipasudorunasgroup,
@@ -1020,7 +1011,7 @@ IPA.sudorule_association_table_widget = function(spec) {
spec = spec || {};
- var that = IPA.rule_association_table_widget(spec);
+ var that = IPA.association_table_widget(spec);
that.external = spec.external;