summaryrefslogtreecommitdiffstats
path: root/install/static
diff options
context:
space:
mode:
Diffstat (limited to 'install/static')
-rw-r--r--install/static/associate.js26
-rw-r--r--install/static/details.js3
-rw-r--r--install/static/entity.js55
-rwxr-xr-xinstall/static/hbac.js42
-rwxr-xr-xinstall/static/hbacsvc.js21
-rwxr-xr-xinstall/static/hbacsvcgroup.js41
-rw-r--r--install/static/search.js30
-rw-r--r--install/static/test/data/service_disable.json9
-rw-r--r--install/static/test/data/sudorule_add.json24
-rw-r--r--install/static/test/data/sudorule_del.json9
-rw-r--r--install/static/test/data/sudorule_mod.json51
-rw-r--r--install/static/test/entity_tests.js2
12 files changed, 215 insertions, 98 deletions
diff --git a/install/static/associate.js b/install/static/associate.js
index f0239a44e..01f7551a2 100644
--- a/install/static/associate.js
+++ b/install/static/associate.js
@@ -241,6 +241,7 @@ function ipa_association_widget(spec) {
var that = ipa_table_widget(spec);
+ that.facet = spec.facet;
that.other_entity = spec.other_entity;
that.superior_create = that.superior('create');
@@ -257,11 +258,10 @@ function ipa_association_widget(spec) {
that.superior_create(container);
- var entity_container = $('#' + that.entity_name);
- var action_panel = $('.action-panel', entity_container);
+ var action_panel = that.facet.get_action_panel();
var ul = $('ul', action_panel);
- var li = $('<li/>').appendTo(ul);
+ var li = $('<li/>').prependTo(ul);
// creating generic buttons for layout
$('<input/>', {
@@ -282,7 +282,8 @@ function ipa_association_widget(spec) {
that.table_setup(container);
// replacing generic buttons with ipa_button and setting click handler
- var action_panel = $('.action-panel');
+ var action_panel = that.facet.get_action_panel();
+
var button = $('input[name=remove]', action_panel);
button.replaceWith(ipa_button({
'label': button.val(),
@@ -428,19 +429,10 @@ function ipa_association_facet(spec) {
that.create = function(container) {
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
- that.other_entity =
- $.bbq.getState(that.entity_name + '-enroll', true) || '';
+ that.other_entity = $.bbq.getState(that.entity_name + '-enroll', true) || '';
var label = IPA.metadata[that.other_entity] ? IPA.metadata[that.other_entity].label : that.other_entity;
- that.table = ipa_association_widget({
- 'id': that.entity_name+'-'+that.other_entity,
- 'name': 'association',
- 'label': label,
- 'entity_name': that.entity_name,
- 'other_entity': that.other_entity
- });
-
//TODO I18N
var header_message = that.other_entity + '(s) enrolled in ' +
that.entity_name + ' ' + that.pkey;
@@ -449,12 +441,14 @@ function ipa_association_facet(spec) {
'id': that.entity_name+'-'+that.other_entity,
html: $('<h2/>',{ html: header_message })
}).appendTo(container);
+
that.table = ipa_association_widget({
'id': that.entity_name+'-'+that.other_entity,
'name': that.other_entity,
- 'label': IPA.metadata[that.other_entity].label,
+ 'label': label,
'entity_name': that.entity_name,
- 'other_entity': that.other_entity
+ 'other_entity': that.other_entity,
+ 'facet': that
});
var span = $('<span/>', { 'name': 'association' }).appendTo(container);
diff --git a/install/static/details.js b/install/static/details.js
index 9bf54a8fb..3b4edda6c 100644
--- a/install/static/details.js
+++ b/install/static/details.js
@@ -454,8 +454,7 @@ function ipa_details_create(container)
'class': 'content'
}).appendTo(container);
- var entity_container = $('#' + that.entity_name);
- var action_panel = $('.action-panel', entity_container);
+ var action_panel = that.get_action_panel();
var ul = $('ul', action_panel);
var buttons = $('<li/>', {
diff --git a/install/static/entity.js b/install/static/entity.js
index d117d881c..25a9fd310 100644
--- a/install/static/entity.js
+++ b/install/static/entity.js
@@ -44,7 +44,7 @@ function ipa_facet(spec) {
that._entity_name = entity_name;
});
- that.setup_views = ipa_facet_setup_views;
+ that.create_action_panel = ipa_facet_create_action_panel;
that.superior = function(name) {
var method = that[name];
@@ -66,6 +66,14 @@ function ipa_facet(spec) {
function load() {
}
+ that.get_client_area = function() {
+ return $('#' + that.entity_name+' .client');
+ };
+
+ that.get_action_panel = function() {
+ return $('#' + that.entity_name+' .action-panel');
+ };
+
that.facet_init = that.init;
that.facet_create = that.create;
that.facet_setup = that.setup;
@@ -325,7 +333,7 @@ function ipa_entity_setup(container) {
container.empty();
- facet.setup_views(container);
+ facet.create_action_panel(container);
facet.create(container);
container.children().last().addClass('client');
facet.setup(container);
@@ -333,7 +341,16 @@ function ipa_entity_setup(container) {
}
-function action_panel(entity_name){
+
+function ipa_facet_create_action_panel(container) {
+
+ var that = this;
+ var entity_name = that.entity_name;
+
+ var action_panel = $('<div/>', {
+ "class": "action-panel",
+ html: $('<h3>Actions</h3>')
+ }).appendTo(container);
function build_link(other_facet,label,other_entity){
var li = $('<li/>', {
@@ -345,7 +362,7 @@ function action_panel(entity_name){
if($(this).hasClass('entity-facet-disabled')){
return false;
}
- var this_pkey = $('.action-panel input[id=pkey]').val();
+ var this_pkey = $('input[id=pkey]', action_panel).val();
IPA.switch_and_show_page(
entity_name, other_facet_name,
this_pkey, other_entity);
@@ -357,19 +374,15 @@ function action_panel(entity_name){
return li;
}
- var div = $('<div/>', {
- "class":"action-panel",
- html: $('<h3>Actions</h3>')
- });
-
/*Note, for debugging purposes, it is useful to set var pkey_type = 'text';*/
var pkey_type = 'hidden';
- $('<input/>',
- {'type': pkey_type,
- id:'pkey',
- name:'pkey'}).appendTo(div);
+ $('<input/>', {
+ 'type': pkey_type,
+ id:'pkey',
+ name:'pkey'
+ }).appendTo(action_panel);
- var ul = $('<ul/>', {'class': 'action'}).appendTo(div);
+ var ul = $('<ul/>', {'class': 'action'}).appendTo(action_panel);
var entity = IPA.get_entity(entity_name);
var facet_name = ipa_current_facet(entity);
@@ -380,6 +393,7 @@ function action_panel(entity_name){
if (other_facet.label) {
ul.append(build_link(other_facet,other_facet.label));
+
} else { // For now empty label indicates an association facet
var attribute_members = IPA.metadata[entity_name].attribute_members;
for (var attribute_member in attribute_members) {
@@ -392,19 +406,12 @@ function action_panel(entity_name){
}
}
}
+
/*When we land on the search page, disable all facets
that require a pkey until one is selected*/
if (facet_name === 'search'){
- $('.entity-facet', div).addClass('entity-facet-disabled');
+ $('.entity-facet', action_panel).addClass('entity-facet-disabled');
}
- return div;
-}
-
-function ipa_facet_setup_views(container) {
-
- var facet = this;
- var entity_name = facet.entity_name;
- action_panel(entity_name).appendTo(container);
+ return action_panel;
}
-
diff --git a/install/static/hbac.js b/install/static/hbac.js
index 894b2f4a0..12883efa3 100755
--- a/install/static/hbac.js
+++ b/install/static/hbac.js
@@ -120,31 +120,18 @@ function ipa_hbac_search_facet(spec) {
'label': 'Cull Disabled Rules'
}));
*/
- var entity_container = $('#' + that.entity_name);
- var action_panel = $('.action-panel', entity_container);
+ var action_panel = that.get_action_panel();
var ul = $('ul', action_panel);
$('<li/>', {
title: 'hbacsvc',
- text: 'HBAC Services',
- 'click': function() {
- var state = {};
- state['entity'] = 'hbacsvc';
- nav_push_state(state);
- return false;
- }
+ text: 'HBAC Services'
}).appendTo(ul);
$('<li/>', {
title: 'hbacsvcgroup',
- text: 'HBAC Service Groups',
- 'click': function() {
- var state = {};
- state['entity'] = 'hbacsvcgroup';
- nav_push_state(state);
- return false;
- }
+ text: 'HBAC Service Groups'
}).appendTo(ul);
that.search_facet_create(container);
@@ -156,6 +143,29 @@ function ipa_hbac_search_facet(spec) {
};
+ that.setup = function(container) {
+
+ that.search_facet_setup(container);
+
+ var action_panel = that.get_action_panel();
+
+ var li = $('li[title=hbacsvc]', action_panel);
+ li.click(function() {
+ var state = {};
+ state['entity'] = 'hbacsvc';
+ nav_push_state(state);
+ return false;
+ });
+
+ li = $('li[title=hbacsvcgroup]', action_panel);
+ li.click(function() {
+ var state = {};
+ state['entity'] = 'hbacsvcgroup';
+ nav_push_state(state);
+ return false;
+ });
+ };
+
return that;
}
diff --git a/install/static/hbacsvc.js b/install/static/hbacsvc.js
index 012c92a35..13135da24 100755
--- a/install/static/hbacsvc.js
+++ b/install/static/hbacsvc.js
@@ -26,8 +26,6 @@ function ipa_hbacsvc() {
'name': 'hbacsvc'
});
- that.superior_init = that.superior('init');
-
that.init = function() {
var dialog = ipa_hbacsvc_add_dialog({
@@ -49,7 +47,7 @@ function ipa_hbacsvc() {
});
that.add_facet(facet);
- that.superior_init();
+ that.entity_init();
};
return that;
@@ -82,22 +80,21 @@ function ipa_hbacsvc_search_facet(spec) {
var that = ipa_search_facet(spec);
- that.superior_init = that.superior('init');
- that.superior_create = that.superior('create');
- that.superior_setup = that.superior('setup');
+ that.get_action_panel = function() {
+ return $('#hbac .action-panel');
+ };
that.init = function() {
that.create_column({name:'cn', label:'Service', primary_key: true});
that.create_column({name:'description', label:'Description'});
- that.superior_init();
+ that.search_facet_init();
};
that.create = function(container) {
- var entity_container = $('#' + that.entity_name);
- var action_panel = $('.action-panel', entity_container);
+ var action_panel = that.get_action_panel();
var ul = $('ul', action_panel);
@@ -123,7 +120,7 @@ function ipa_hbacsvc_search_facet(spec) {
}
}).appendTo(ul);
- that.superior_create(container);
+ that.search_facet_create(container);
// TODO: replace with IPA.metadata[that.entity_name].label
container.children().last().prepend(
@@ -149,6 +146,10 @@ function ipa_hbacsvc_details_facet(spec) {
that.superior_create = that.superior('create');
that.superior_setup = that.superior('setup');
+ that.get_action_panel = function() {
+ return $('#hbac .action-panel');
+ };
+
that.init = function() {
var section = ipa_details_list_section({
diff --git a/install/static/hbacsvcgroup.js b/install/static/hbacsvcgroup.js
index 30cb2c86e..520f86004 100755
--- a/install/static/hbacsvcgroup.js
+++ b/install/static/hbacsvcgroup.js
@@ -26,8 +26,6 @@ function ipa_hbacsvcgroup() {
'name': 'hbacsvcgroup'
});
- that.superior_init = that.superior('init');
-
that.init = function() {
that.create_association({
@@ -55,12 +53,12 @@ function ipa_hbacsvcgroup() {
});
that.add_facet(facet);
- facet = ipa_association_facet({
+ facet = ipa_hbacsvcgroup_association_facet({
'name': 'associate'
});
that.add_facet(facet);
- that.superior_init();
+ that.entity_init();
};
return that;
@@ -93,22 +91,21 @@ function ipa_hbacsvcgroup_search_facet(spec) {
var that = ipa_search_facet(spec);
- that.superior_init = that.superior('init');
- that.superior_create = that.superior('create');
- that.superior_setup = that.superior('setup');
+ that.get_action_panel = function() {
+ return $('#hbac .action-panel');
+ };
that.init = function() {
that.create_column({name:'cn', label:'Group', primary_key: true});
that.create_column({name:'description', label:'Description'});
- that.superior_init();
+ that.search_facet_init();
};
that.create = function(container) {
- var entity_container = $('#' + that.entity_name);
- var action_panel = $('.action-panel', entity_container);
+ var action_panel = that.get_action_panel();
var ul = $('ul', action_panel);
@@ -134,7 +131,8 @@ function ipa_hbacsvcgroup_search_facet(spec) {
}
}).appendTo(ul);
- that.superior_create(container);
+ that.search_facet_create(container);
+
// TODO: replace with IPA.metadata[that.entity_name].label
container.children().last().prepend(
$('<h2/>', { 'html': 'HBAC Service Groups' }));
@@ -152,9 +150,9 @@ function ipa_hbacsvcgroup_details_facet(spec) {
var that = ipa_details_facet(spec);
- that.superior_init = that.superior('init');
- that.superior_create = that.superior('create');
- that.superior_setup = that.superior('setup');
+ that.get_action_panel = function() {
+ return $('#hbac .action-panel');
+ };
that.init = function() {
@@ -167,7 +165,20 @@ function ipa_hbacsvcgroup_details_facet(spec) {
section.create_field({ 'name': 'cn', 'label': 'Name' });
section.create_field({ 'name': 'description', 'label': 'Description' });
- that.superior_init();
+ that.details_facet_init();
+ };
+
+ return that;
+}
+
+function ipa_hbacsvcgroup_association_facet(spec) {
+
+ spec = spec || {};
+
+ var that = ipa_association_facet(spec);
+
+ that.get_action_panel = function() {
+ return $('#hbac .action-panel');
};
return that;
diff --git a/install/static/search.js b/install/static/search.js
index 91c6641bb..03d4cac5a 100644
--- a/install/static/search.js
+++ b/install/static/search.js
@@ -28,7 +28,7 @@ function ipa_search_widget(spec) {
var that = ipa_table_widget(spec);
- that.superior_create = that.superior('create');
+ that.facet = spec.facet;
that.create = function(container) {
@@ -52,8 +52,7 @@ function ipa_search_widget(spec) {
'value': 'Find'
}).appendTo(search_filter);
- var entity_container = $('#' + that.entity_name);
- var action_panel = $('.action-panel', entity_container);
+ var action_panel = that.facet.get_action_panel();
var ul = $('ul', action_panel);
var li = $('<li/>').prependTo(ul);
@@ -78,7 +77,7 @@ function ipa_search_widget(spec) {
'class': 'search-results'
}).appendTo(container);
- that.superior_create(container);
+ that.table_create(container);
};
that.setup = function(container) {
@@ -95,8 +94,7 @@ function ipa_search_widget(spec) {
});
button.replaceWith(that.find_button);
- var entity_container = $('#' + that.entity_name);
- var action_panel = $('.action-panel', entity_container);
+ var action_panel = that.facet.get_action_panel();
var search_buttons = $('.search-buttons', action_panel);
button = $('input[name=remove]', search_buttons);
@@ -143,19 +141,21 @@ function ipa_search_widget(spec) {
count += 1;
pkey = $(this).val();
});
+
+ var action_panel = that.facet.get_action_panel();
if(count == 1){
- $('.action-panel li.entity-facet').
+ $('li.entity-facet', action_panel).
removeClass('entity-facet-disabled');
var state = {};
- $('.action-panel input[id=pkey]').val(pkey);
+ $('input[id=pkey]', action_panel).val(pkey);
}else{
- $('.action-panel li.entity-facet').
+ $('li.entity-facet', action_panel).
addClass('entity-facet-disabled');
- $('.action-panel input').val(null);
+ $('input', action_panel).val(null);
}
return false;
- }
+ };
that.remove = function(container) {
@@ -262,7 +262,7 @@ function ipa_search_facet(spec) {
var that = ipa_facet(spec);
that.init = spec.init || init;
- that.create = spec.create || ipa_search_facet_create;
+ that.create = spec.create || create;
that.setup = spec.setup || setup;
that.refresh = spec.refresh || refresh;
@@ -306,7 +306,8 @@ function ipa_search_facet(spec) {
that.table = ipa_search_widget({
'id': that.entity_name+'-search',
'name': 'search', 'label': IPA.metadata[that.entity_name].label,
- 'entity_name': that.entity_name
+ 'entity_name': that.entity_name,
+ 'facet': that
});
for (var i=0; i<that.columns.length; i++) {
@@ -327,7 +328,7 @@ function ipa_search_facet(spec) {
return filter != that.filter;
};
- function ipa_search_facet_create(container) {
+ function create(container) {
container.attr('title', that.entity_name);
@@ -357,6 +358,7 @@ function ipa_search_facet(spec) {
that.search_facet_init = that.init;
that.search_facet_create = that.create;
+ that.search_facet_setup = that.setup;
return that;
}
diff --git a/install/static/test/data/service_disable.json b/install/static/test/data/service_disable.json
new file mode 100644
index 000000000..d62c05472
--- /dev/null
+++ b/install/static/test/data/service_disable.json
@@ -0,0 +1,9 @@
+{
+ "error": null,
+ "id": 0,
+ "result": {
+ "result": true,
+ "summary": "Removed kerberos key from \"test/dev.example.com@DEV.EXAMPLE.COM\"",
+ "value": "test/dev.example.com@DEV.EXAMPLE.COM"
+ }
+}
diff --git a/install/static/test/data/sudorule_add.json b/install/static/test/data/sudorule_add.json
new file mode 100644
index 000000000..2b2b63947
--- /dev/null
+++ b/install/static/test/data/sudorule_add.json
@@ -0,0 +1,24 @@
+{
+ "error": null,
+ "id": 0,
+ "result": {
+ "result": {
+ "cn": [
+ "test"
+ ],
+ "description": [
+ "test"
+ ],
+ "dn": "ipauniqueid=94ef3550-f443-11df-a2aa-00163e72f2d9,cn=sudorules,dc=dev,dc=example,dc=com",
+ "ipauniqueid": [
+ "94ef3550-f443-11df-a2aa-00163e72f2d9"
+ ],
+ "objectclass": [
+ "ipaassociation",
+ "ipasudorule"
+ ]
+ },
+ "summary": "Added sudo rule \"test\"",
+ "value": "test"
+ }
+}
diff --git a/install/static/test/data/sudorule_del.json b/install/static/test/data/sudorule_del.json
new file mode 100644
index 000000000..c30979892
--- /dev/null
+++ b/install/static/test/data/sudorule_del.json
@@ -0,0 +1,9 @@
+{
+ "error": null,
+ "id": 0,
+ "result": {
+ "result": true,
+ "summary": null,
+ "value": "test"
+ }
+}
diff --git a/install/static/test/data/sudorule_mod.json b/install/static/test/data/sudorule_mod.json
new file mode 100644
index 000000000..7785f5f5e
--- /dev/null
+++ b/install/static/test/data/sudorule_mod.json
@@ -0,0 +1,51 @@
+{
+ "error": null,
+ "id": 0,
+ "result": {
+ "result": {
+ "attributelevelrights": {
+ "aci": "rscwo",
+ "cmdcategory": "rscwo",
+ "cn": "rscwo",
+ "description": "rscwo",
+ "externalhost": "rscwo",
+ "externaluser": "rscwo",
+ "hostcategory": "rscwo",
+ "hostmask": "rscwo",
+ "ipaenabledflag": "rscwo",
+ "ipasudoopt": "rscwo",
+ "ipasudorunas": "rscwo",
+ "ipasudorunasextgroup": "rscwo",
+ "ipasudorunasextuser": "rscwo",
+ "ipasudorunasgroup": "rscwo",
+ "ipasudorunasgroupcategory": "rscwo",
+ "ipasudorunasusercategory": "rscwo",
+ "ipauniqueid": "rsc",
+ "memberallowcmd": "rscwo",
+ "memberdenycmd": "rscwo",
+ "memberhost": "rscwo",
+ "memberuser": "rscwo",
+ "nsaccountlock": "rscwo",
+ "usercategory": "rscwo"
+ },
+ "cmdcategory": [
+ "all"
+ ],
+ "cn": [
+ "test"
+ ],
+ "description": [
+ "Test Rule"
+ ],
+ "ipauniqueid": [
+ "94ef3550-f443-11df-a2aa-00163e72f2d9"
+ ],
+ "objectclass": [
+ "ipaassociation",
+ "ipasudorule"
+ ]
+ },
+ "summary": null,
+ "value": "test"
+ }
+}
diff --git a/install/static/test/entity_tests.js b/install/static/test/entity_tests.js
index c431031de..8f016efee 100644
--- a/install/static/test/entity_tests.js
+++ b/install/static/test/entity_tests.js
@@ -101,7 +101,7 @@ test('Testing ipa_facet_setup_views().', function() {
counter++;
};
- facet.setup_views(container);
+ facet.create_action_panel(container);
//Container now has two divs, one for the action panel one for content
var list = container.children().last().children();