2010-08-13 16:56:16 -05:00
|
|
|
# Authors:
|
|
|
|
# Pavel Zuna <pzuna@redhat.com>
|
2010-11-17 21:15:09 -06:00
|
|
|
# Adam YOung <ayoung@redhat.com>
|
2010-08-13 16:56:16 -05:00
|
|
|
#
|
|
|
|
# Copyright (c) 2010 Red Hat
|
|
|
|
# See file 'copying' for use and warranty information
|
|
|
|
#
|
2010-12-09 06:59:11 -06:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2010-08-13 16:56:16 -05:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
2010-12-09 06:59:11 -06:00
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2010-08-13 16:56:16 -05:00
|
|
|
#
|
2010-12-09 06:59:11 -06:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2010-08-13 16:56:16 -05:00
|
|
|
"""
|
|
|
|
Plugins not accessible directly through the CLI, commands used internally
|
|
|
|
"""
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
|
|
|
from ipalib import api, errors
|
|
|
|
from ipalib import Command
|
|
|
|
from ipalib import Str
|
|
|
|
from ipalib.output import Output
|
|
|
|
from ipalib.text import _
|
|
|
|
from ipalib.util import json_serialize
|
|
|
|
|
|
|
|
class json_metadata(Command):
|
|
|
|
"""
|
|
|
|
Export plugin meta-data for the webUI.
|
|
|
|
"""
|
2011-01-20 14:07:43 -06:00
|
|
|
NO_CLI = True
|
2010-09-24 19:48:23 -05:00
|
|
|
|
2010-11-17 21:15:09 -06:00
|
|
|
|
|
|
|
takes_args = (
|
|
|
|
Str('objname?',
|
|
|
|
doc=_('Name of object to export'),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
has_output = (
|
|
|
|
Output('metadata', dict, doc=_('Dict of JSON encoded IPA Objects')),
|
|
|
|
)
|
|
|
|
|
|
|
|
def execute(self, objname):
|
|
|
|
|
|
|
|
if objname and objname in self.api.Object:
|
|
|
|
|
|
|
|
meta = dict(
|
|
|
|
result=dict(
|
|
|
|
((objname, json_serialize(self.api.Object[objname])), )
|
|
|
|
)
|
|
|
|
)
|
2010-12-02 10:05:54 -06:00
|
|
|
retval= dict([("metadata",meta)])
|
2010-11-17 21:15:09 -06:00
|
|
|
|
|
|
|
else:
|
|
|
|
meta=dict(
|
|
|
|
(o.name, json_serialize(o)) for o in self.api.Object()
|
|
|
|
)
|
|
|
|
|
|
|
|
retval= dict([("metadata",meta)])
|
|
|
|
|
|
|
|
return retval
|
|
|
|
|
|
|
|
def output_for_cli(self, textui, result, *args, **options):
|
|
|
|
print json.dumps(result, default=json_serialize)
|
|
|
|
|
|
|
|
api.register(json_metadata)
|
|
|
|
|
|
|
|
class i18n_messages(Command):
|
2011-01-20 14:07:43 -06:00
|
|
|
NO_CLI = True
|
|
|
|
|
2010-09-24 19:48:23 -05:00
|
|
|
messages={
|
|
|
|
"login": {"header" :_("Logged In As")},
|
|
|
|
"button":{
|
|
|
|
"add":_("Add"),
|
|
|
|
"find": _("Find"),
|
|
|
|
"reset":_("Reset"),
|
|
|
|
"update":_("Update"),
|
2010-10-01 11:40:30 -05:00
|
|
|
"enroll":_("Enroll"),
|
2010-11-08 19:39:40 -06:00
|
|
|
"remove":_("Delete"),
|
2010-09-24 19:48:23 -05:00
|
|
|
},
|
2011-01-14 14:14:32 -06:00
|
|
|
"facets":{
|
|
|
|
"search":_("Search"),
|
|
|
|
"details": _("Settings"),
|
|
|
|
},
|
2010-09-24 19:48:23 -05:00
|
|
|
"search":{
|
2010-10-01 11:40:30 -05:00
|
|
|
"quick_links":_("Quick Links"),
|
|
|
|
"select_all":_("Select All"),
|
|
|
|
"unselect_all":_("Unselect All"),
|
2011-01-21 18:19:54 -06:00
|
|
|
"delete_confirm":_("Are you sure you want to delete selected entries?"),
|
2010-09-24 19:48:23 -05:00
|
|
|
},
|
|
|
|
"details":{
|
2011-01-14 14:14:32 -06:00
|
|
|
"identity":_("Identity Settings"),
|
|
|
|
"account":_("Account Settings"),
|
|
|
|
"contact":_("Contact Settings"),
|
2010-09-24 19:48:23 -05:00
|
|
|
"mailing":_("Mailing Address"),
|
2011-01-14 14:14:32 -06:00
|
|
|
"employee":_("Employee Information"),
|
2010-09-24 19:48:23 -05:00
|
|
|
"misc":_("Misc. Information"),
|
2010-11-05 18:48:42 -05:00
|
|
|
"to_top":_("Back to Top")},
|
2011-01-25 18:39:08 -06:00
|
|
|
"tabs": {
|
|
|
|
"identity":_("Identity"),
|
|
|
|
"policy":_("Policy"),
|
|
|
|
"audit": _("Audit"),
|
|
|
|
"ipaserver":_("IPA Server"),
|
|
|
|
"sudo":_("SUDO"),
|
|
|
|
"hbac":_("HBAC")},
|
2010-12-02 17:16:34 -06:00
|
|
|
"association":{
|
|
|
|
"managedby":_("Managed by"),
|
|
|
|
"members":_("Members"),
|
|
|
|
"membershipin":_("Membership in")},
|
2010-11-05 18:48:42 -05:00
|
|
|
"ajax":{
|
|
|
|
"401":_("Your kerberos ticket no longer valid."+
|
|
|
|
"Please run KInit and then click 'retry'"+
|
|
|
|
"If this is your first time running the IPA Web UI"+
|
|
|
|
"<a href='/ipa/errors/ssbrowser.html'> "+
|
|
|
|
"Follow these directions</a> to configure your browser.")
|
|
|
|
}
|
2010-09-24 19:48:23 -05:00
|
|
|
}
|
2010-08-13 16:56:16 -05:00
|
|
|
has_output = (
|
2010-09-24 19:48:23 -05:00
|
|
|
Output('messages', dict, doc=_('Dict of I18N messages')),
|
2010-08-13 16:56:16 -05:00
|
|
|
)
|
2010-11-17 21:15:09 -06:00
|
|
|
def execute(self):
|
|
|
|
return dict([("messages",json_serialize(self.messages))])
|
2010-08-13 16:56:16 -05:00
|
|
|
|
|
|
|
def output_for_cli(self, textui, result, *args, **options):
|
|
|
|
print json.dumps(result, default=json_serialize)
|
|
|
|
|
|
|
|
|
2010-11-17 21:15:09 -06:00
|
|
|
api.register(i18n_messages)
|