summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-02-18 00:02:51 -0600
committerAdam Young <ayoung@redhat.com>2011-02-18 10:10:35 -0500
commite245b6da9bc87c23df64edcc240d49358f558ef7 (patch)
tree073fcd721a78d92ea95c60fc0a91dbbcc60bd842
parentfa75959486ddbd0be00f3611457e940215635a3a (diff)
downloadfreeipa-e245b6da9bc87c23df64edcc240d49358f558ef7.tar.gz
freeipa-e245b6da9bc87c23df64edcc240d49358f558ef7.tar.xz
freeipa-e245b6da9bc87c23df64edcc240d49358f558ef7.zip
Updated json_metadata and i18n_messages.
The json_metadata() has been updated to return ipa.Objects and ipa.Methods. The i18n_messages() has been updated to include other messages that are not available from the metadata.
-rw-r--r--API.txt10
-rw-r--r--ipalib/plugins/baseldap.py10
-rw-r--r--ipalib/plugins/hbacrule.py4
-rw-r--r--ipalib/plugins/host.py1
-rw-r--r--ipalib/plugins/internal.py298
-rw-r--r--ipalib/plugins/service.py1
6 files changed, 299 insertions, 25 deletions
diff --git a/API.txt b/API.txt
index 6e532da88..cb0eb514f 100644
--- a/API.txt
+++ b/API.txt
@@ -1280,7 +1280,7 @@ option: Str('nsosversion', attribute=True, cli_name='os', label=Gettext('Operati
option: Str('userpassword', attribute=True, cli_name='password', label=Gettext('User password', domain='ipa', localedir=None), multivalue=False, required=False)
option: Flag('random', attribute=True, autofill=True, cli_name='random', default=False, flags=['no_search'], label=FixMe('random'), multivalue=False, required=False)
option: Bytes('usercertificate', validate_certificate, attribute=True, cli_name='certificate', label=Gettext('Certificate', domain='ipa', localedir=None), multivalue=False, required=False)
-option: Flag('force', autofill=True, default=False,lag('force', autofill=True, default=False, doc=Gettext('force host name even if not in DNS', domain='ipa', localedir=None))
+option: Flag('force', autofill=True, default=False, label=Gettext('Force', domain='ipa', localedir=None))
option: Flag('no_reverse', autofill=True, default=False,lag('no_reverse', autofill=True, default=False, doc=Gettext('skip reverse DNS detection', domain='ipa', localedir=None))
option: Str('ip_address?', validate_ipaddr,tr('ip_address?', validate_ipaddr, doc=Gettext('Add the host to DNS with this IP address', domain='ipa', localedir=None))
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui', flags=['no_output'])
@@ -1472,9 +1472,11 @@ command: i18n_messages
args: 0,0,1
output: Output('messages', <type 'dict'>, Gettext('Dict of I18N messages', domain='ipa', localedir=None))
command: json_metadata
-args: 1,0,1
+args: 2,0,2
arg: Str('objname?',tr('objname?', doc=Gettext('Name of object to export', domain='ipa', localedir=None))
-output: Output('metadata', <type 'dict'>, Gettext('Dict of JSON encoded IPA Objects', domain='ipa', localedir=None))
+arg: Str('methodname?',tr('methodname?', doc=Gettext('Name of method to export', domain='ipa', localedir=None))
+output: Output('objects', <type 'dict'>, Gettext('Dict of JSON encoded IPA Objects', domain='ipa', localedir=None))
+output: Output('methods', <type 'dict'>, Gettext('Dict of JSON encoded IPA Methods', domain='ipa', localedir=None))
command: krbtpolicy_mod
args: 1,8,3
arg: Str('uid', attribute=True, cli_name='user', label=Gettext('User name', domain='ipa', localedir=None), multivalue=False, primary_key=True, query=True, required=False)
@@ -2082,7 +2084,7 @@ command: service_add
args: 1,5,3
arg: Str('krbprincipalname', validate_principal, attribute=True, cli_name='principal', label=Gettext('Principal', domain='ipa', localedir=None), multivalue=False, normalizer=<lambda>, primary_key=True, required=True)
option: Bytes('usercertificate', validate_certificate, attribute=True, cli_name='certificate', flags=['no_search'], label=Gettext('Certificate', domain='ipa', localedir=None), multivalue=False, required=False)
-option: Flag('force', autofill=True, default=False,lag('force', autofill=True, default=False, doc=Gettext('force principal name even if not in DNS', domain='ipa', localedir=None))
+option: Flag('force', autofill=True, default=False, label=Gettext('Force', domain='ipa', localedir=None))
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui', flags=['no_output'])
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui', flags=['no_output'])
option: Str('version?', exclude='webui', flags=['no_option', 'no_output'])
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 2d25219da..2e284274b 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -620,6 +620,16 @@ class LDAPCreate(CallbackInterface, crud.Create):
def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs):
raise exc
+ # list of attributes we want exported to JSON
+ json_friendly_attributes = (
+ 'takes_options',
+ )
+
+ def __json__(self):
+ json_dict = dict(
+ (a, getattr(self, a)) for a in self.json_friendly_attributes
+ )
+ return json_dict
class LDAPQuery(CallbackInterface, crud.PKQuery):
"""
diff --git a/ipalib/plugins/hbacrule.py b/ipalib/plugins/hbacrule.py
index cb4dbb4f3..6445199a1 100644
--- a/ipalib/plugins/hbacrule.py
+++ b/ipalib/plugins/hbacrule.py
@@ -194,6 +194,10 @@ class hbacrule(LDAPObject):
label=_('Source hosts'),
flags=['no_create', 'no_update', 'no_search'],
),
+ Str('sourcehost_hostgroup?',
+ label=_('Source host groups'),
+ flags=['no_create', 'no_update', 'no_search'],
+ ),
Str('memberservice_hbacsvc?',
label=_('Services'),
flags=['no_create', 'no_update', 'no_search'],
diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py
index 73bad5f88..b819688d0 100644
--- a/ipalib/plugins/host.py
+++ b/ipalib/plugins/host.py
@@ -293,6 +293,7 @@ class host_add(LDAPCreate):
member_attributes = ['managedby']
takes_options = (
Flag('force',
+ label=_('Force'),
doc=_('force host name even if not in DNS'),
),
Flag('no_reverse',
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 66ad45f2a..e8b34a09b 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -42,29 +42,44 @@ class json_metadata(Command):
Str('objname?',
doc=_('Name of object to export'),
),
+ Str('methodname?',
+ doc=_('Name of method to export'),
+ ),
)
has_output = (
- Output('metadata', dict, doc=_('Dict of JSON encoded IPA Objects')),
+ Output('objects', dict, doc=_('Dict of JSON encoded IPA Objects')),
+ Output('methods', dict, doc=_('Dict of JSON encoded IPA Methods')),
)
- def execute(self, objname):
+ def execute(self, objname, methodname):
if objname and objname in self.api.Object:
- meta = dict(
- result=dict(
- ((objname, json_serialize(self.api.Object[objname])), )
- )
+ objects = dict(
+ (objname, json_serialize(self.api.Object[objname]))
)
- retval= dict([("metadata",meta)])
else:
- meta=dict(
+ objects = dict(
(o.name, json_serialize(o)) for o in self.api.Object()
- )
+ )
+
+ if methodname and methodname in self.api.Method:
+
+ methods = dict(
+ (methodname, json_serialize(self.api.Method[methodname]))
+ )
+
+ else:
+ methods = dict(
+ (m.name, json_serialize(m)) for m in self.api.Method()
+ )
- retval= dict([("metadata",meta)])
+ retval = dict([
+ ("objects", objects),
+ ("methods", methods),
+ ])
return retval
@@ -78,13 +93,247 @@ class i18n_messages(Command):
messages={
"login": {"header" :_("Logged In As")},
- "button":{
+ "objects": {
+ "aci": {
+ "attribute":_("Attribute"),
+ },
+ "automountlocation": {
+ "add":_("Add Automount Location"),
+ "identity":_("Automount Location Settings"),
+ },
+ "cert": {
+ "unspecified":_("Unspecified"),
+ "key_compromise":_("Key Compromise"),
+ "ca_compromise":_("CA Compromise"),
+ "affiliation_changed":_("Affiliation Changed"),
+ "superseded":_("Superseded"),
+ "cessation_of_operation":_("Cessation of Operation"),
+ "certificate_hold":_("Certificate Hold"),
+ "remove_from_crl":_("Remove from CRL"),
+ "privilege_withdrawn":_("Privilege Withdrawn"),
+ "aa_compromise":_("AA Compromise"),
+ "revoke_confirmation":_(
+ "To confirm your intention to revoke this certificate, "+
+ "select a reason from the pull-down list, and click "+
+ "the \"Revoke\" button."),
+ "note":_("Note"),
+ "reason":_("Reason for Revocation"),
+ "restore_confirmation":_(
+ "To confirm your intention to restore this certificate, "+
+ "click the \"Restore\" button."),
+ "issued_to":_("Issued To"),
+ "common_name":_("Common Name"),
+ "organization":_("Organization"),
+ "organizational_unit":_("Organizational Unit"),
+ "serial_number":_("Serial Number"),
+ "issued_by":_("Issued By"),
+ "validity":_("Validity"),
+ "issued_on":_("Issued On"),
+ "expires_on":_("Expires On"),
+ "fingerprints":_("Fingerprints"),
+ "sha1_fingerprint":_("SHA1 Fingerprint"),
+ "md5_fingerprint":_("MD5 Fingerprint"),
+ "enter_csr":_("Enter the Base64-encoded CSR below"),
+ "valid":_("Valid Certificate Present"),
+ "new_certificate":_("New Certificate"),
+ "revoked":_("Certificate Revoked"),
+ "missing":_("No Valid Certificate"),
+ "view_certificate":_("Certificate for ${entity} ${primary_key}"),
+ "issue_certificate":_("Issue New Certificate for ${entity} ${primary_key}"),
+ "revoke_certificate":_("Revoke Certificate for ${entity} ${primary_key}"),
+ "restore_certificate":_("Restore Certificate for ${entity} ${primary_key}"),
+ },
+ "config": {
+ "ipaserver":_("Configuration"),
+ "cn":_("Name"),
+ },
+ "delegation": {
+ "add":_("Add Delegation"),
+ },
+ "dnszone": {
+ "add":_("Add DNS Zone"),
+ "identity":_("DNS Zone Settings"),
+ },
+ "dnsrecord": {
+ "add":_("Add DNS Resource Record"),
+ "resource":_("Resource"),
+ "type":_("Type"),
+ "data":_("Data"),
+ "title":_("Records for DNS Zone"),
+ },
+ "group": {
+ "add":_("Add New Group"),
+ "details":_("Group Settings"),
+ "posix":_("Is this a POSIX group?"),
+ },
+ "hbacrule": {
+ "add":_("Add New Rule"),
+ "active":_("Active"),
+ "allow":_("Allow"),
+ "deny":_("Deny"),
+ "inactive":_("Inactive"),
+ "ipaenabledflag":_("Rule status"),
+ "user":_("Who"),
+ "anyone":_("Anyone"),
+ "specified_users":_("Specified Users and Groups"),
+ "host":_("Accessing"),
+ "any_host":_("Any Host"),
+ "specified_hosts":_("Specified Hosts and Groups"),
+ "service":_("Via Service"),
+ "any_service":_("Any Service"),
+ "specified_services":_("Specified Services and Groups"),
+ "sourcehost":_("From"),
+ },
+ "hbacsvc": {
+ "add":_("Add New HBAC Service"),
+ },
+ "hbacsvcgroup": {
+ "add":_("Add New HBAC Service Group"),
+ "services":_("Services"),
+ },
+ "host": {
+ "add":_("Add New Host"),
+ "certificate":_("Host Certificate"),
+ "cn":_("Host Name"),
+ "details":_("Host Settings"),
+ "enrolled":_("Enrolled?"),
+ "enrollment":_("Enrollment"),
+ "fqdn":_("Fully Qualified Host Name"),
+ "posix":_("Is this a POSIX group?"),
+ "status":_("Status"),
+ "valid":_("Kerberos Key Present, Host Provisioned"),
+ "delete_key_unprovision":_("Delete Key, Unprovision"),
+ "missing":_("Kerberos Key Not Present"),
+ "enroll_otp":_("Enroll via One-Time-Password"),
+ "set_otp":_("Set OTP"),
+ "otp_confirmation":_("One-Time-Password has been set."),
+ "unprovision_title":_("Unprovisioning ${entity}"),
+ "unprovision_confirmation":_("Are you sure you want to unprovision this host?"),
+ "unprovision":_("Unprovision"),
+ },
+ "hostgroup": {
+ "add":_("Add Hostgroup"),
+ "identity":_("Hostgroup Settings"),
+ },
+ "krbtpolicy": {
+ "identity":_("Kerberos ticket policy"),
+ },
+ "netgroup": {
+ "add":_("Add Netgroup"),
+ "identity":_("Netgroup Settings"),
+ },
+ "permission": {
+ "add":_("Add Permission"),
+ "identity":_("Identity"),
+ "rights":_("Rights"),
+ "target":_("Target"),
+ "filter":_("Filter"),
+ "subtree":_("By Subtree"),
+ "targetgroup":_("Target Group"),
+ "type":_("Object By Type"),
+ "invalid_target":_("Permission with invalid target specification"),
+ },
+ "privilege": {
+ "add":_("Add Privilege"),
+ "identity":_("Privilege Settings"),
+ },
+ "pwpolicy": {
+ "add":_("Add Password Policy"),
+ "identity":_("Password Policy"),
+ },
+ "role": {
+ "add":_("Add Role"),
+ "identity":_("Role Settings"),
+ },
+ "selfservice": {
+ "add":_("Add Self Service Definition"),
+ },
+ "service": {
+ "add":_("Add New Service"),
+ "certificate":_("Service Certificate"),
+ "details":_("Service Settings"),
+ "host":_("Host Name"),
+ "provisioning":_("Provisioning"),
+ "service":_("Service"),
+ "status":_("Status"),
+ "valid":_("Kerberos Key Present, Service Provisioned"),
+ "delete_key_unprovision":_("Delete Key, Unprovision"),
+ "missing":_("Kerberos Key Not Present"),
+ "unprovision_title":_("Unprovisioning ${entity}"),
+ "unprovision_confirmation":_("Are you sure you want to unprovision this service?"),
+ "unprovision":_("Unprovision"),
+ },
+ "sudocmd": {
+ "add":_("Add New SUDO Command"),
+ "groups":_("Groups"),
+ },
+ "sudocmdgroup": {
+ "add":_("Add New SUDO Command Group"),
+ "commands":_("Commands"),
+ },
+ "sudorule": {
+ "add":_("Add New Rule"),
+ "active":_("Active"),
+ "inactive":_("Inactive"),
+ "allow":_("Allow"),
+ "deny":_("Deny"),
+ "user":_("Who"),
+ "anyone":_("Anyone"),
+ "specified_users":_("Specified Users and Groups"),
+ "host":_("Access this host"),
+ "any_host":_("Any Host"),
+ "specified_hosts":_("Specified Hosts and Groups"),
+ "command":_("Run Commands"),
+ "any_command":_("Any Command"),
+ "specified_commands":_("Specified Commands and Groups"),
+ "runas":_("As Whom"),
+ "any_group":_("Any Group"),
+ "specified_groups":_("Specified Groups"),
+ "ipaenabledflag":_("Rule status"),
+ "external":_("External"),
+ },
+ "user": {
+ "add":_("Add User"),
+ "account":_("Account Settings"),
+ "contact":_("Contact Settings"),
+ "mailing":_("Mailing Address"),
+ "employee":_("Employee Information"),
+ "misc":_("Misc. Information"),
+ "active":_("Active"),
+ "deactivate":_("Click to Deactivate"),
+ "inactive":_("Inactive"),
+ "activate":_("Click to Activate"),
+ "error_changing_status":_("Error changing account status"),
+ "reset_password":_("Reset password"),
+ "new_password":_("New Password"),
+ "repeat_password":_("Repeat Password"),
+ "password_change_complete":_("Password change complete"),
+ "password_must_match":_("Passwords must match"),
+ },
+ },
+ "buttons":{
"add":_("Add"),
+ "add_and_add_another":_("Add and Add Another"),
+ "add_and_edit":_("Add and Edit"),
+ "add_and_close":_("Add and Close"),
+ "cancel": _("Cancel"),
"find": _("Find"),
+ "get": _("Get"),
"reset":_("Reset"),
"update":_("Update"),
"enroll":_("Enroll"),
"remove":_("Delete"),
+ "restore":_("Restore"),
+ "revoke":_("Revoke"),
+ "view":_("View"),
+ "back_to_list":_("Back to List"),
+ },
+ "dialogs":{
+ "remove_empty":_("Select ${entity} to be removed."),
+ "remove_title":_("Remove ${entity}."),
+ "hide_already_enrolled":_("Hide already enrolled."),
+ "available":_("Available"),
+ "prospective":_("Prospective"),
},
"facets":{
"search":_("Search"),
@@ -95,15 +344,16 @@ class i18n_messages(Command):
"select_all":_("Select All"),
"unselect_all":_("Unselect All"),
"delete_confirm":_("Are you sure you want to delete selected entries?"),
+ "truncated":_(
+ "Query returned results than configured size limit will show. " +
+ "First ${counter} results shown."),
},
"details":{
+ "general":_("General"),
+ "settings":_("${entity} Settings"),
"identity":_("Identity Settings"),
- "account":_("Account Settings"),
- "contact":_("Contact Settings"),
- "mailing":_("Mailing Address"),
- "employee":_("Employee Information"),
- "misc":_("Misc. Information"),
- "to_top":_("Back to Top")},
+ "to_top":_("Back to Top")
+ },
"tabs": {
"identity":_("Identity"),
"policy":_("Policy"),
@@ -111,11 +361,17 @@ class i18n_messages(Command):
"ipaserver":_("IPA Server"),
"sudo":_("SUDO"),
"hbac":_("HBAC"),
- "role":_("Role Based Access Control")},
+ "role":_("Role Based Access Control")
+ },
"association":{
- "managedby":_("Managed by"),
- "members":_("Members"),
- "membershipin":_("Membership in")},
+ "add":_("Add ${other_entity} into ${entity} ${primary_key}"),
+ "member":_("${other_entity} enrolled in ${entity} ${primary_key}"),
+ "parent":_("${entity} ${primary_key} is enrolled in the following ${other_entity}"),
+ "remove":_("Remove ${other_entity} from ${entity} ${primary_key}"),
+ },
+ "widget":{
+ "validation_error":_("Text does not match field pattern"),
+ },
"ajax":{
"401":_("Your kerberos ticket no longer valid."+
"Please run KInit and then click 'retry'"+
diff --git a/ipalib/plugins/service.py b/ipalib/plugins/service.py
index 6bf165241..21889aa69 100644
--- a/ipalib/plugins/service.py
+++ b/ipalib/plugins/service.py
@@ -326,6 +326,7 @@ class service_add(LDAPCreate):
has_output_params = LDAPCreate.has_output_params + output_params
takes_options = (
Flag('force',
+ label=_('Force'),
doc=_('force principal name even if not in DNS'),
),
)