A new attribute label_singular has been added to all entities which
contains the singular form of the entity label in lower cases except
for acronyms (e.g. HBAC) or proper nouns (e.g. Kerberos). In the Web
UI, this label can be capitalized using CSS text-transform.

The existing 'label' attribute is intentionally left unchanged due to
inconsistencies in the current values. It contains mostly the plural
form of capitalized entity label, but some are singular. Also, it
seems currently there is no comparable capitalization method on the
server-side. So more work is needed before the label can be changed.

Ticket #1249

--
Endi S. Dewata
From 148ccc34887f7d5fdc04949475b614d8861fcc4a Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Thu, 23 Jun 2011 19:48:50 -0500
Subject: [PATCH] Added singular entity labels.

A new attribute label_singular has been added to all entities which
contains the singular form of the entity label in lower cases except
for acronyms (e.g. HBAC) or proper nouns (e.g. Kerberos). In the Web
UI, this label can be capitalized using CSS text-transform.

The existing 'label' attribute is intentionally left unchanged due to
inconsistencies in the current values. It contains mostly the plural
form of capitalized entity label, but some are singular. Also, it
seems currently there is no comparable capitalization method on the
server-side. So more work is needed before the label can be changed.

Ticket #1249
---
 install/ui/test/data/ipa_init.json |   27 +++++++++++++++++++++++++++
 ipalib/plugins/automount.py        |    4 +++-
 ipalib/plugins/baseldap.py         |    3 ++-
 ipalib/plugins/config.py           |    1 +
 ipalib/plugins/delegation.py       |    3 ++-
 ipalib/plugins/dns.py              |    2 ++
 ipalib/plugins/entitle.py          |    1 +
 ipalib/plugins/group.py            |    1 +
 ipalib/plugins/hbacrule.py         |    1 +
 ipalib/plugins/hbacsvc.py          |    1 +
 ipalib/plugins/hbacsvcgroup.py     |    1 +
 ipalib/plugins/host.py             |    1 +
 ipalib/plugins/hostgroup.py        |    1 +
 ipalib/plugins/krbtpolicy.py       |    1 +
 ipalib/plugins/netgroup.py         |    1 +
 ipalib/plugins/permission.py       |    1 +
 ipalib/plugins/privilege.py        |    1 +
 ipalib/plugins/pwpolicy.py         |    1 +
 ipalib/plugins/role.py             |    1 +
 ipalib/plugins/selfservice.py      |    3 ++-
 ipalib/plugins/service.py          |    1 +
 ipalib/plugins/sudocmd.py          |    1 +
 ipalib/plugins/sudocmdgroup.py     |    1 +
 ipalib/plugins/sudorule.py         |    1 +
 ipalib/plugins/user.py             |    1 +
 25 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index b74e1b41a4d35dd68b83b6239f772649e2c79e0a..94bd68868e1ed63da855ad69bd459b32d5ebed0e 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -7719,6 +7719,7 @@
                             "aci"
                         ],
                         "label": "Automount Keys",
+                        "label_singular": "automount key",
                         "methods": [
                             "add",
                             "del",
@@ -7863,6 +7864,7 @@
                             "aci"
                         ],
                         "label": "Automount Locations",
+                        "label_singular": "automount location",
                         "methods": [
                             "add",
                             "del",
@@ -7951,6 +7953,7 @@
                             "aci"
                         ],
                         "label": "Automount Maps",
+                        "label_singular": "automount map",
                         "methods": [
                             "add",
                             "add_indirect",
@@ -8070,6 +8073,7 @@
                             "aci"
                         ],
                         "label": "Configuration",
+                        "label_singular": "configuration",
                         "methods": [
                             "mod",
                             "show"
@@ -9336,6 +9340,7 @@
                             "aci"
                         ],
                         "label": "Entry",
+                        "label_singular": "entry",
                         "methods": [
                             "add",
                             "del",
@@ -9460,6 +9465,7 @@
                     "delegation": {
                         "bindable": false,
                         "label": "Delegation",
+                        "label_singular": "delegation",
                         "methods": [
                             "add",
                             "del",
@@ -9681,6 +9687,7 @@
                             "aci"
                         ],
                         "label": "DNS resource record",
+                        "label_singular": "DNS resource record",
                         "methods": [
                             "add",
                             "add_record",
@@ -9898,6 +9905,7 @@
                             "aci"
                         ],
                         "label": "DNS",
+                        "label_singular": "DNS zone",
                         "methods": [
                             "add",
                             "del",
@@ -10297,6 +10305,7 @@
                             "aci"
                         ],
                         "label": "Entitlements",
+                        "label_singular": "entitlement",
                         "methods": [
                             "consume",
                             "find",
@@ -10399,6 +10408,7 @@
                             "aci"
                         ],
                         "label": "User Groups",
+                        "label_singular": "user group",
                         "methods": [
                             "add",
                             "add_member",
@@ -10579,6 +10589,7 @@
                             "aci"
                         ],
                         "label": "HBAC Rule",
+                        "label_singular": "HBAC rule",
                         "methods": [
                             "add",
                             "add_host",
@@ -11102,6 +11113,7 @@
                             "aci"
                         ],
                         "label": "HBAC Services",
+                        "label_singular": "HBAC service",
                         "methods": [
                             "add",
                             "del",
@@ -11228,6 +11240,7 @@
                             "aci"
                         ],
                         "label": "HBAC service Groups",
+                        "label_singular": "HBAC service group",
                         "methods": [
                             "add",
                             "add_member",
@@ -11392,6 +11405,7 @@
                             "aci"
                         ],
                         "label": "Hosts",
+                        "label_singular": "host",
                         "methods": [
                             "add",
                             "add_managedby",
@@ -11793,6 +11807,7 @@
                             "aci"
                         ],
                         "label": "Host Groups",
+                        "label_singular": "host group",
                         "methods": [
                             "add",
                             "add_member",
@@ -11905,6 +11920,7 @@
                             "aci"
                         ],
                         "label": "Kerberos Ticket Policy",
+                        "label_singular": "Kerberos ticket policy",
                         "methods": [
                             "mod",
                             "reset",
@@ -12070,6 +12086,7 @@
                             "aci"
                         ],
                         "label": "Netgroups",
+                        "label_singular": "netgroup",
                         "methods": [
                             "add",
                             "add_member",
@@ -12309,6 +12326,7 @@
                             "aci"
                         ],
                         "label": "Permissions",
+                        "label_singular": "permission",
                         "methods": [
                             "add",
                             "add_member",
@@ -12621,6 +12639,7 @@
                             "aci"
                         ],
                         "label": "Privileges",
+                        "label_singular": "privilege",
                         "methods": [
                             "add",
                             "add_member",
@@ -12754,6 +12773,7 @@
                             "aci"
                         ],
                         "label": "Password Policy",
+                        "label_singular": "password policy",
                         "methods": [
                             "add",
                             "del",
@@ -13071,6 +13091,7 @@
                             "aci"
                         ],
                         "label": "Role",
+                        "label_singular": "role",
                         "methods": [
                             "add",
                             "add_member",
@@ -13174,6 +13195,7 @@
                     "selfservice": {
                         "bindable": false,
                         "label": "Self Service Permissions",
+                        "label_singular": "self service permission",
                         "methods": [
                             "add",
                             "del",
@@ -13311,6 +13333,7 @@
                             "aci"
                         ],
                         "label": "Services",
+                        "label_singular": "service",
                         "methods": [
                             "add",
                             "add_host",
@@ -13426,6 +13449,7 @@
                             "aci"
                         ],
                         "label": "Sudo Commands",
+                        "label_singular": "sudo command",
                         "methods": [
                             "add",
                             "del",
@@ -13552,6 +13576,7 @@
                             "aci"
                         ],
                         "label": "Sudo Command Groups",
+                        "label_singular": "sudo command group",
                         "methods": [
                             "add",
                             "add_member",
@@ -13779,6 +13804,7 @@
                             "aci"
                         ],
                         "label": "Sudo Rule",
+                        "label_singular": "sudo rule",
                         "methods": [
                             "add",
                             "add_allow_command",
@@ -14547,6 +14573,7 @@
                             "aci"
                         ],
                         "label": "Users",
+                        "label_singular": "user",
                         "methods": [
                             "add",
                             "del",
diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py
index 11cea5c90335da1015447c84a9b1d719e5a98b16..5f8102d9209bd35ea348c484e994c08a5cea01df 100644
--- a/ipalib/plugins/automount.py
+++ b/ipalib/plugins/automount.py
@@ -188,7 +188,7 @@ class automountlocation(LDAPObject):
     object_class = ['nscontainer']
     default_attributes = ['cn']
     label = _('Automount Locations')
-
+    label_singular = _('automount location')
 
     takes_params = (
         Str('cn',
@@ -513,6 +513,7 @@ class automountmap(LDAPObject):
     )
 
     label = _('Automount Maps')
+    label_singular = _('automount map')
 
 api.register(automountmap)
 
@@ -604,6 +605,7 @@ class automountkey(LDAPObject):
 
     num_parents = 2
     label = _('Automount Keys')
+    label_singular = _('automount key')
     already_exists_msg = _('The key,info pair must be unique. A key named %(key)s with info %(info)s already exists')
     key_already_exists_msg = _('key named %(key)s already exists')
     object_not_found_msg = _('The automount key %(key)s with info %(info)s does not exist')
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 95e628cd06c8384b27ed7ad9788c4046c2c28986..2e9991317c5d97cae4495e957a692dfc1f6dfa75 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -280,6 +280,7 @@ class LDAPObject(Object):
         ),
     }
     label = _('Entry')
+    label_singular = _('entry')
 
     container_not_found_msg = _('container entry (%(container)s) not found')
     parent_not_found_msg = _('%(parent)s: %(oname)s not found')
@@ -376,7 +377,7 @@ class LDAPObject(Object):
     # list of attributes we want exported to JSON
     json_friendly_attributes = (
         'parent_object', 'container_dn', 'object_name', 'object_name_plural',
-        'object_class', 'object_class_config', 'default_attributes', 'label',
+        'object_class', 'object_class_config', 'default_attributes', 'label', 'label_singular',
         'hidden_attributes', 'uuid_attribute', 'attribute_members', 'name',
         'takes_params', 'rdn_attribute', 'bindable', 'relationships',
     )
diff --git a/ipalib/plugins/config.py b/ipalib/plugins/config.py
index 9d55f95e334847779e912b04f1019d99e018afd4..5e5baad84e07b2682db5c45b506acdcadbe9bfb5 100644
--- a/ipalib/plugins/config.py
+++ b/ipalib/plugins/config.py
@@ -89,6 +89,7 @@ class config(LDAPObject):
     ]
 
     label = _('Configuration')
+    label_singular = _('configuration')
 
     takes_params = (
         Int('ipamaxusernamelength?',
diff --git a/ipalib/plugins/delegation.py b/ipalib/plugins/delegation.py
index c3b5e4825f184ce69308da833f1e356ace844a72..07f602be7161c2cb03873a097bf70df72b2482ab 100644
--- a/ipalib/plugins/delegation.py
+++ b/ipalib/plugins/delegation.py
@@ -100,6 +100,7 @@ class delegation(Object):
     object_name = 'delegation',
     object_name_plural = 'delegation',
     label = _('Delegation')
+    label_singular = _('delegation')
 
     takes_params = (
         Str('aciname',
@@ -134,7 +135,7 @@ class delegation(Object):
 
     def __json__(self):
         json_friendly_attributes = (
-            'label', 'takes_params', 'bindable', 'name',
+            'label', 'label_singular', 'takes_params', 'bindable', 'name',
             'object_name', 'object_name_plural',
         )
         json_dict = dict(
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index cc2e6e548fee33e5a89ab5e29b12df6aef239c38..d5cffe46d66ce624203276354568a5fd2b80e052 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -283,6 +283,7 @@ class dnszone(LDAPObject):
         'idnssoaminimum'
     ] + _record_attributes
     label = _('DNS')
+    label_singular = _('DNS zone')
 
     takes_params = (
         Str('idnsname',
@@ -521,6 +522,7 @@ class dnsrecord(LDAPObject):
     default_attributes = _record_attributes + ['idnsname']
 
     label = _('DNS resource record')
+    label_singular = _('DNS resource record')
 
     takes_params = (
         Str('idnsname',
diff --git a/ipalib/plugins/entitle.py b/ipalib/plugins/entitle.py
index ab7dd456ff76b677561bbcb45ab3769d82150505..95aff39ee01190ed405ca88be7c825bd364edc3d 100644
--- a/ipalib/plugins/entitle.py
+++ b/ipalib/plugins/entitle.py
@@ -187,6 +187,7 @@ class entitle(LDAPObject):
     uuid_attribute = 'ipaentitlementid'
 
     label = _('Entitlements')
+    label_singular = _('entitlement')
 
     """
     def get_dn(self, *keys, **kwargs):
diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py
index 163a6f5dab4d3f3312d7bfdf5c5fa84896416f2c..e44ad7f248b5b9a4ce40de4c63c744e93abeec63 100644
--- a/ipalib/plugins/group.py
+++ b/ipalib/plugins/group.py
@@ -98,6 +98,7 @@ class group(LDAPObject):
     rdnattr = 'cn'
 
     label = _('User Groups')
+    label_singular = _('user group')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/hbacrule.py b/ipalib/plugins/hbacrule.py
index e282fa2196118a887989a60c6e5de9e111e98b7c..531d2d90fb06d41b1263a2cf81225f019ae1c689 100644
--- a/ipalib/plugins/hbacrule.py
+++ b/ipalib/plugins/hbacrule.py
@@ -124,6 +124,7 @@ class hbacrule(LDAPObject):
     }
 
     label = _('HBAC Rule')
+    label_singular = _('HBAC rule')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/hbacsvc.py b/ipalib/plugins/hbacsvc.py
index 3fe9f0fb301256e70494cc7764071279fea7507c..df877a605f60a62284ecc57348f452ab01d1aacf 100644
--- a/ipalib/plugins/hbacsvc.py
+++ b/ipalib/plugins/hbacsvc.py
@@ -59,6 +59,7 @@ class hbacsvc(LDAPObject):
     uuid_attribute = 'ipauniqueid'
 
     label = _('HBAC Services')
+    label_singular = _('HBAC service')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/hbacsvcgroup.py b/ipalib/plugins/hbacsvcgroup.py
index f50a6c6ee23184fe76ecf0bddd76b666045a40d2..1685f9115102999119fac907b5d848246d6a327a 100644
--- a/ipalib/plugins/hbacsvcgroup.py
+++ b/ipalib/plugins/hbacsvcgroup.py
@@ -62,6 +62,7 @@ class hbacsvcgroup(LDAPObject):
     }
 
     label = _('HBAC service Groups')
+    label_singular = _('HBAC service group')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py
index 1cd3fc061852b9caea749cd0fb82e6170f513e4e..eff199b42041338d7470d43bdb9e691153b0e248 100644
--- a/ipalib/plugins/host.py
+++ b/ipalib/plugins/host.py
@@ -244,6 +244,7 @@ class host(LDAPObject):
     }
 
     label = _('Hosts')
+    label_singular = _('host')
 
     takes_params = (
         Str('fqdn', validate_host,
diff --git a/ipalib/plugins/hostgroup.py b/ipalib/plugins/hostgroup.py
index 4ffc2217e943359bb9559f8fb04aa07da0968b82..abf01b4fa12671ad86281e9e43b0bb560cfd4606 100644
--- a/ipalib/plugins/hostgroup.py
+++ b/ipalib/plugins/hostgroup.py
@@ -71,6 +71,7 @@ class hostgroup(LDAPObject):
     }
 
     label = _('Host Groups')
+    label_singular = _('host group')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/krbtpolicy.py b/ipalib/plugins/krbtpolicy.py
index 4347f41461b31a44f803b3d1ba98ae19093fc286..0c76256b7f0d634cfc187f3fd422bbb29e2c3626 100644
--- a/ipalib/plugins/krbtpolicy.py
+++ b/ipalib/plugins/krbtpolicy.py
@@ -77,6 +77,7 @@ class krbtpolicy(LDAPObject):
     limit_object_classes = ['krbticketpolicyaux']
 
     label=_('Kerberos Ticket Policy')
+    label_singular = _('Kerberos ticket policy')
 
     takes_params = (
         Str('uid?',
diff --git a/ipalib/plugins/netgroup.py b/ipalib/plugins/netgroup.py
index 7c2fc55e20484091723675cfac507083f0278d87..56e026ed240632186059d0e26afb159fd8980e4f 100644
--- a/ipalib/plugins/netgroup.py
+++ b/ipalib/plugins/netgroup.py
@@ -96,6 +96,7 @@ class netgroup(LDAPObject):
     }
 
     label = _('Netgroups')
+    label_singular = _('netgroup')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py
index 7988b33c28226cf9cb4d7b1600e30fb6bba6bf31..63f166c6f67ee3d6e48bac28673e32272ff7f2f8 100644
--- a/ipalib/plugins/permission.py
+++ b/ipalib/plugins/permission.py
@@ -105,6 +105,7 @@ class permission(LDAPObject):
     rdnattr='cn'
 
     label = _('Permissions')
+    label_singular = _('permission')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/privilege.py b/ipalib/plugins/privilege.py
index 24398002f4f6c22b52902643f75c09d749373a71..890dcd7cc842f4c87a4383d9dd00542cd5d07515 100644
--- a/ipalib/plugins/privilege.py
+++ b/ipalib/plugins/privilege.py
@@ -63,6 +63,7 @@ class privilege(LDAPObject):
     rdnattr='cn'
 
     label = _('Privileges')
+    label_singular = _('privilege')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/pwpolicy.py b/ipalib/plugins/pwpolicy.py
index b360cd9dcaa9fc1ebbd25c68c35bffd527b35ab9..fc1f7015f6fc133b2bb5d56bbfa61847792a82c0 100644
--- a/ipalib/plugins/pwpolicy.py
+++ b/ipalib/plugins/pwpolicy.py
@@ -217,6 +217,7 @@ class pwpolicy(LDAPObject):
         )
 
     label = _('Password Policy')
+    label_singular = _('password policy')
 
     takes_params = (
         Str('cn?',
diff --git a/ipalib/plugins/role.py b/ipalib/plugins/role.py
index 5e41bf4977ee9210282de6a68cd1f41869a8c4e0..dc6341ac43fd9ce40954551e116259c861021a2d 100644
--- a/ipalib/plugins/role.py
+++ b/ipalib/plugins/role.py
@@ -79,6 +79,7 @@ class role(LDAPObject):
     rdnattr='cn'
 
     label = _('Role')
+    label_singular = _('role')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/selfservice.py b/ipalib/plugins/selfservice.py
index 666178cb1d3d1cc8554d101da8762c0f3ef7dea1..8154d2da8a3e6005c7ab583efe00e47b45a4e8ed 100644
--- a/ipalib/plugins/selfservice.py
+++ b/ipalib/plugins/selfservice.py
@@ -73,6 +73,7 @@ class selfservice(Object):
     object_name = 'selfservice',
     object_name_plural = 'selfservice',
     label = _('Self Service Permissions')
+    label_singular = _('self service permission')
 
     takes_params = (
         Str('aciname',
@@ -97,7 +98,7 @@ class selfservice(Object):
 
     def __json__(self):
         json_friendly_attributes = (
-            'label', 'takes_params', 'bindable', 'name',
+            'label', 'label_singular', 'takes_params', 'bindable', 'name',
             'object_name', 'object_name_plural',
         )
         json_dict = dict(
diff --git a/ipalib/plugins/service.py b/ipalib/plugins/service.py
index 14e04d26b4d2eba51d12fea8be912d43bee134ac..4f8bc1eb83fad0c9c57cb03e6cc0a3aa8946ebb9 100644
--- a/ipalib/plugins/service.py
+++ b/ipalib/plugins/service.py
@@ -218,6 +218,7 @@ class service(LDAPObject):
     }
 
     label = _('Services')
+    label_singular = _('service')
 
     takes_params = (
         Str('krbprincipalname', validate_principal,
diff --git a/ipalib/plugins/sudocmd.py b/ipalib/plugins/sudocmd.py
index f8c4a8e790d71c9e9f832ca20f710a0b3b9f9bb0..a3f3beb0d503dca088d47ab292a581b1da1a660b 100644
--- a/ipalib/plugins/sudocmd.py
+++ b/ipalib/plugins/sudocmd.py
@@ -62,6 +62,7 @@ class sudocmd(LDAPObject):
     }
     uuid_attribute = 'ipauniqueid'
     label = _('Sudo Commands')
+    label_singular = _('sudo command')
 
     takes_params = (
         Str('sudocmd',
diff --git a/ipalib/plugins/sudocmdgroup.py b/ipalib/plugins/sudocmdgroup.py
index 3931111fcdef44f85da725dc7bf6e552029c5503..49b172ea293d8914de16c596e4206327e03bed78 100644
--- a/ipalib/plugins/sudocmdgroup.py
+++ b/ipalib/plugins/sudocmdgroup.py
@@ -63,6 +63,7 @@ class sudocmdgroup(LDAPObject):
     }
 
     label = _('Sudo Command Groups')
+    label_singular = _('sudo command group')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/sudorule.py b/ipalib/plugins/sudorule.py
index 7b70356e1a240c9956f169ab00f40635d6919656..fec1d642ee9ab1b60c5685f9f22b2c5360b95f5e 100644
--- a/ipalib/plugins/sudorule.py
+++ b/ipalib/plugins/sudorule.py
@@ -66,6 +66,7 @@ class sudorule(LDAPObject):
     }
 
     label = _('Sudo Rule')
+    label_singular = _('sudo rule')
 
     takes_params = (
         Str('cn',
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index de1aa33f3eb12ddab162ab83e2a9fe2b1c6ca3ff..1f85238daeccb67349cd53242356f19c9e6b81ea 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -106,6 +106,7 @@ class user(LDAPObject):
     rdnattr = 'uid'
     bindable = True
 
+    label_singular = _('user')
     label = _('Users')
 
     takes_params = (
-- 
1.7.5.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to