The users, HBAC/sudo rules, HBAC test, and SELinux list pages have been modified to show disabled entries in gray. Icons will be added separately.
Ticket #1996 -- Endi S. Dewata
From 5a7973c150ee2afaf91bbe692b127903fb9ef7fc Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata <edew...@redhat.com> Date: Wed, 18 Jan 2012 17:58:55 -0600 Subject: [PATCH] Show disabled entries in gray. The users, HBAC/sudo rules, HBAC test, and SELinux list pages have been modified to show disabled entries in gray. Icons will be added separately. Ticket #1996 --- install/ui/facet.js | 25 +++++- install/ui/hbac.js | 5 +- install/ui/hbactest.js | 14 ++- install/ui/ipa.css | 4 + install/ui/selinux.js | 5 +- install/ui/sudo.js | 5 +- install/ui/test/data/hbacrule_get_records.json | 15 +++ .../ui/test/data/selinuxusermap_find_pkeys.json | 8 ++- .../ui/test/data/selinuxusermap_get_records.json | 30 ++++++ install/ui/test/data/sudorule_find_pkeys.json | 8 ++- install/ui/test/data/sudorule_get_records.json | 98 +++++++++++++++++++- install/ui/test/data/user_get_records.json | 6 +- install/ui/user.js | 4 +- install/ui/widget.js | 28 ++++++- 14 files changed, 239 insertions(+), 16 deletions(-) diff --git a/install/ui/facet.js b/install/ui/facet.js index d65024942d39c621905e1a1aaa87a907dfa460e4..150c3e8faad29381372c31358ea928db14c0be0c 100644 --- a/install/ui/facet.js +++ b/install/ui/facet.js @@ -413,6 +413,9 @@ IPA.table_facet = function(spec) { that.search_all_attributes = spec.search_all_attributes; that.selectable = spec.selectable === undefined ? true : spec.selectable; + that.row_enabled_attribute = spec.row_enabled_attribute; + that.row_disabled_attribute = spec.row_disabled_attribute; + that.columns = $.ordered_map(); var init = function() { @@ -605,11 +608,31 @@ IPA.table_facet = function(spec) { that.load_records = function(records) { that.table.empty(); for (var i=0; i<records.length; i++) { - that.table.add_record(records[i]); + that.add_record(records[i]); } that.table.set_values(that.selected_values); }; + that.add_record = function(record) { + + var tr = that.table.add_record(record); + + var attribute; + if (that.row_enabled_attribute) { + attribute = that.row_enabled_attribute; + } else if (that.row_disabled_attribute) { + attribute = that.row_disabled_attribute; + } else { + return; + } + + var value = record[attribute]; + var column = that.table.get_column(attribute); + if (column.format) value = column.format.parse(value); + + that.table.set_row_enabled(tr, value); + }; + that.get_records_command_name = function() { return that.managed_entity.name+'_get_records'; }; diff --git a/install/ui/hbac.js b/install/ui/hbac.js index 34c9b285ef2c5d8be58312c19fac541d6dcc9e20..5d6de15d303ac60eecf85207ccdfadcf64540af9 100644 --- a/install/ui/hbac.js +++ b/install/ui/hbac.js @@ -37,12 +37,15 @@ IPA.hbac.rule_entity = function(spec) { that.entity_init(); that.builder.search_facet({ + row_enabled_attribute: 'ipaenabledflag', search_all_attributes: true, columns: [ 'cn', { name: 'ipaenabledflag', - format: IPA.boolean_format() + format: IPA.boolean_format({ + show_false: true + }) }, 'description' ] diff --git a/install/ui/hbactest.js b/install/ui/hbactest.js index f054c913a7b5027106b25b90b4eccdcdabdba68a..b529a1d5ff6bba40883c7eef196ca5d5b339af33 100644 --- a/install/ui/hbactest.js +++ b/install/ui/hbactest.js @@ -43,6 +43,7 @@ IPA.hbac.test_entity = function(spec) { managed_entity: 'user', disable_breadcrumb: true, facet_group: 'default', + row_disabled_attribute: 'nsaccountlock', columns: [ 'uid', 'givenname', @@ -52,7 +53,8 @@ IPA.hbac.test_entity = function(spec) { format: IPA.boolean_format({ true_value: IPA.messages.objects.user.active, false_value: IPA.messages.objects.user.inactive, - invert_value: true + invert_value: true, + show_false: true }), label: IPA.messages.objects.user.account_status } @@ -111,11 +113,14 @@ IPA.hbac.test_entity = function(spec) { managed_entity: 'hbacrule', disable_breadcrumb: true, facet_group: 'default', + row_enabled_attribute: 'ipaenabledflag', columns: [ 'cn', { name: 'ipaenabledflag', - format: IPA.boolean_format() + format: IPA.boolean_format({ + show_false: true + }) }, 'description' ] @@ -127,6 +132,7 @@ IPA.hbac.test_entity = function(spec) { managed_entity: 'hbacrule', disable_breadcrumb: true, facet_group: 'default', + row_enabled_attribute: 'ipaenabledflag', columns: [ 'cn', { @@ -136,7 +142,9 @@ IPA.hbac.test_entity = function(spec) { }, { name: 'ipaenabledflag', - format: IPA.boolean_format() + format: IPA.boolean_format({ + show_false: true + }) }, 'description' ] diff --git a/install/ui/ipa.css b/install/ui/ipa.css index ab27bcfcb9b86d5988d67752492e34da07a1f4f3..10fed5de70807c937344850c6dd1c0029ff5ed14 100644 --- a/install/ui/ipa.css +++ b/install/ui/ipa.css @@ -659,6 +659,10 @@ div[name=settings].facet-group li a { bottom: 35px; } +.content-table tbody tr.disabled { + color: gray; +} + .search-filter { width: 215px; -moz-border-radius: 15px !important; diff --git a/install/ui/selinux.js b/install/ui/selinux.js index bfe25df0862c648320f42db0f99ab22d48282eaa..1ca11760d3919e49025087b3d69488363e5a2a5b 100644 --- a/install/ui/selinux.js +++ b/install/ui/selinux.js @@ -35,13 +35,16 @@ IPA.selinux.selinuxusermap_entity = function(spec) { that.entity_init(); that.builder.search_facet({ + row_enabled_attribute: 'ipaenabledflag', search_all_attributes: true, columns: [ 'cn', 'ipaselinuxuser', { name: 'ipaenabledflag', - format: IPA.boolean_format() + format: IPA.boolean_format({ + show_false: true + }) }, 'description' ] diff --git a/install/ui/sudo.js b/install/ui/sudo.js index 2266bb8c459d9191dcb5de92ee511a304140ca16..f1b64bd55b6cdc2c25ccd23c64d781ac43d9066b 100644 --- a/install/ui/sudo.js +++ b/install/ui/sudo.js @@ -36,11 +36,14 @@ IPA.sudo.rule_entity = function(spec) { that.entity_init(); that.builder.search_facet({ + row_enabled_attribute: 'ipaenabledflag', columns: [ 'cn', { name: 'ipaenabledflag', - format: IPA.boolean_format() + format: IPA.boolean_format({ + show_false: true + }) }, 'description' ] diff --git a/install/ui/test/data/hbacrule_get_records.json b/install/ui/test/data/hbacrule_get_records.json index 2ae32f52a28c8fed739b8be36eb19c909246e215..bff83920bcb6c97e7f86e5f876647d1bd98d26ab 100644 --- a/install/ui/test/data/hbacrule_get_records.json +++ b/install/ui/test/data/hbacrule_get_records.json @@ -52,6 +52,9 @@ "cn": [ "rule01" ], + "description": [ + "Test HBAC Rule 01" + ], "dn": "ipauniqueid=ce568648-211c-11e1-8846-000c29e9f1b6,cn=hbac,dc=example,dc=com", "hostcategory": [ "all" @@ -88,6 +91,9 @@ "cn": [ "rule02" ], + "description": [ + "Test HBAC Rule 02" + ], "dn": "ipauniqueid=d0133224-211c-11e1-b881-000c29e9f1b6,cn=hbac,dc=example,dc=com", "hostcategory": [ "all" @@ -124,6 +130,9 @@ "cn": [ "rule03" ], + "description": [ + "Test HBAC Rule 03" + ], "dn": "ipauniqueid=d21db45e-211c-11e1-bef8-000c29e9f1b6,cn=hbac,dc=example,dc=com", "hostcategory": [ "all" @@ -160,6 +169,9 @@ "cn": [ "rule04" ], + "description": [ + "Test HBAC Rule 04" + ], "dn": "ipauniqueid=d4209604-211c-11e1-9192-000c29e9f1b6,cn=hbac,dc=example,dc=com", "hostcategory": [ "all" @@ -196,6 +208,9 @@ "cn": [ "rule05" ], + "description": [ + "Test HBAC Rule 05" + ], "dn": "ipauniqueid=d59dba70-211c-11e1-9ce3-000c29e9f1b6,cn=hbac,dc=example,dc=com", "hostcategory": [ "all" diff --git a/install/ui/test/data/selinuxusermap_find_pkeys.json b/install/ui/test/data/selinuxusermap_find_pkeys.json index 016e512676d1ccd16682a53ab6414dbb4ee61b19..a4163febdeec70f4ae329910e275c707fc2cac11 100644 --- a/install/ui/test/data/selinuxusermap_find_pkeys.json +++ b/install/ui/test/data/selinuxusermap_find_pkeys.json @@ -9,9 +9,15 @@ "karel_unconfined" ], "dn": "ipauniqueid=dbe2ffa0-3c2c-11e1-ad81-00163e6185c4,cn=usermap,cn=selinux,dc=dev,dc=example,dc=com" + }, + { + "cn": [ + "test01" + ], + "dn": "ipauniqueid=dbe2ffa0-3c2c-11e1-ad81-00163e6185c4,cn=usermap,cn=selinux,dc=dev,dc=example,dc=com" } ], - "summary": "1 SELinux User Map matched", + "summary": "2 SELinux User Maps matched", "truncated": false } } \ No newline at end of file diff --git a/install/ui/test/data/selinuxusermap_get_records.json b/install/ui/test/data/selinuxusermap_get_records.json index 61d80fb5c85a0ee013279f5fdf38cc0f151fba0a..518b1365400706a3f9041c4d5239c233de74bd80 100644 --- a/install/ui/test/data/selinuxusermap_get_records.json +++ b/install/ui/test/data/selinuxusermap_get_records.json @@ -33,6 +33,36 @@ }, "summary": null, "value": "karel_unconfined" + }, + { + "error": null, + "result": { + "cn": [ + "test01" + ], + "description": [ + "Test SELinux User Map 01" + ], + "dn": "ipauniqueid=dbe2ffa0-3c2c-11e1-ad81-00163e6185c4,cn=usermap,cn=selinux,dc=dev,dc=example,dc=com", + "ipaenabledflag": [ + "FALSE" + ], + "ipaselinuxuser": [ + "xguest_u:s0" + ], + "ipauniqueid": [ + "dbe2ffa0-3c2c-11e1-ad81-00163e6185c4" + ], + "memberuser_user": [ + "karel" + ], + "objectclass": [ + "ipaassociation", + "ipaselinuxusermap" + ] + }, + "summary": null, + "value": "test01" } ] } diff --git a/install/ui/test/data/sudorule_find_pkeys.json b/install/ui/test/data/sudorule_find_pkeys.json index a72894db3d0edf5cee8bbdb6f524ebbb47fcceef..139fc0a2728a2d4dc723ff7d11719780fd5038c3 100644 --- a/install/ui/test/data/sudorule_find_pkeys.json +++ b/install/ui/test/data/sudorule_find_pkeys.json @@ -6,7 +6,13 @@ "result": [ { "cn": [ - "test" + "test01" + ], + "dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,cn=sudo,dc=example,dc=com" + }, + { + "cn": [ + "test02" ], "dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,cn=sudo,dc=example,dc=com" } diff --git a/install/ui/test/data/sudorule_get_records.json b/install/ui/test/data/sudorule_get_records.json index 7e1d09cc5b2aaf5e33695949e5db66ab6de22e8c..e005dfeac5c77eeda107b2802286ba70371aeff6 100644 --- a/install/ui/test/data/sudorule_get_records.json +++ b/install/ui/test/data/sudorule_get_records.json @@ -33,7 +33,10 @@ "usercategory": "rscwo" }, "cn": [ - "test" + "test01" + ], + "description": [ + "Test Sudo Rule 01" ], "dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,cn=sudo,dc=example,dc=com", "externalhost": [ @@ -90,7 +93,98 @@ ] }, "summary": null, - "value": "test" + "value": "test01" + }, + { + "error": null, + "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" + }, + "cn": [ + "test02" + ], + "description": [ + "Test Sudo Rule 02" + ], + "dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,cn=sudo,dc=example,dc=com", + "externalhost": [ + "external.example.com" + ], + "externaluser": [ + "external" + ], + "ipaenabledflag": [ + "FALSE" + ], + "ipasudoopt": [ + "-H", + "-b" + ], + "ipasudorunas_user": [ + "admin" + ], + "ipasudorunasgroup_group": [ + "admins" + ], + "ipauniqueid": [ + "4fc57a02-f23311df-b268e50e-a3b3ef71" + ], + "memberallowcmd_sudocmd": [ + "/usr/bin/less" + ], + "memberallowcmd_sudocmdgroup": [ + "group1" + ], + "memberdenycmd_sudocmd": [ + "/usr/bin/more" + ], + "memberdenycmd_sudocmdgroup": [ + "group1", + "group2" + ], + "memberhost_host": [ + "dev.example.com" + ], + "memberhost_hostgroup": [ + "production", + "staging" + ], + "memberuser_group": [ + "editors" + ], + "memberuser_user": [ + "test" + ], + "objectclass": [ + "ipaassociation", + "ipasudorule" + ] + }, + "summary": null, + "value": "test02" } ] } diff --git a/install/ui/test/data/user_get_records.json b/install/ui/test/data/user_get_records.json index c45a45c60067bdd49b1573374e0ecb4b1aa78d8a..8814bff74fa730af436aaaa2c8b0b6c3c21f9c0b 100644 --- a/install/ui/test/data/user_get_records.json +++ b/install/ui/test/data/user_get_records.json @@ -610,7 +610,7 @@ "mepmanagedentry": [ "cn=aortega,cn=groups,cn=accounts,dc=example,dc=com" ], - "nsaccountlock": false, + "nsaccountlock": true, "objectclass": [ "top", "person", @@ -681,7 +681,7 @@ "mepmanagedentry": [ "cn=aortiz,cn=groups,cn=accounts,dc=example,dc=com" ], - "nsaccountlock": false, + "nsaccountlock": true, "objectclass": [ "top", "person", @@ -1107,7 +1107,7 @@ "mepmanagedentry": [ "cn=bbauer,cn=groups,cn=accounts,dc=example,dc=com" ], - "nsaccountlock": false, + "nsaccountlock": true, "objectclass": [ "top", "person", diff --git a/install/ui/user.js b/install/ui/user.js index 681228347d631cd4ac5b67ec6baebd34a3de66e2..92ac86a8380bf47fd19110e599b70a1e07d694b4 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -36,6 +36,7 @@ IPA.user.entity = function(spec) { var link = self_service ? false : undefined; that.builder.search_facet({ + row_disabled_attribute: 'nsaccountlock', columns: [ 'uid', 'givenname', @@ -45,7 +46,8 @@ IPA.user.entity = function(spec) { format: IPA.boolean_format({ true_value: IPA.messages.objects.user.active, false_value: IPA.messages.objects.user.inactive, - invert_value: true + invert_value: true, + show_false: true }), label: IPA.messages.objects.user.account_status }, diff --git a/install/ui/widget.js b/install/ui/widget.js index 4972372cb7cb4009ea4c8c4d644dd09daa0e0680..85d9282c25cb6b0b65c18825124f3b463944697d 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -947,6 +947,12 @@ IPA.format = function(spec) { var that = {}; + // parse attribute value into a normalized value + that.parse = function(value) { + return value; + }; + + // format normalized value that.format = function(value) { return value; }; @@ -965,7 +971,8 @@ IPA.boolean_format = function(spec) { that.show_false = spec.show_false; that.invert_value = spec.invert_value; - that.format = function(value) { + // convert string boolean value into real boolean value, or keep the original value + that.parse = function(value) { if (value === undefined || value === null) return ''; @@ -985,7 +992,15 @@ IPA.boolean_format = function(spec) { if (typeof value === 'boolean') { if (that.invert_value) value = !value; + } + return value; + }; + + // convert boolean value into formatted string, or keep the original value + that.format = function(value) { + + if (typeof value === 'boolean') { if (value) { value = that.true_value; @@ -1035,6 +1050,7 @@ IPA.column = function (spec) { var value = record[that.name]; if (that.format) { + value = that.format.parse(value); value = that.format.format(value); } value = value ? value.toString() : ''; @@ -1482,6 +1498,16 @@ IPA.table_widget = function (spec) { that.setup_column(column, div, record); } + + return tr; + }; + + that.set_row_enabled = function(tr, enabled) { + if (enabled) { + tr.removeClass('disabled'); + } else { + tr.addClass('disabled'); + } }; that.setup_column = function(column, div, record) { -- 1.7.5.1
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel