diff options
author | Rob Crittenden <rcritten@redhat.com> | 2008-01-04 16:39:41 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2008-01-04 16:39:41 -0500 |
commit | 1c4e4b3e141996ad89d999257b3bfe10b1d150df (patch) | |
tree | e11cc14f2cf30018734bb62333ccaed4874feada | |
parent | dd28d4e6f61e62839aed78ee7076578c1b1f8fa8 (diff) | |
download | freeipa-1c4e4b3e141996ad89d999257b3bfe10b1d150df.tar.gz freeipa-1c4e4b3e141996ad89d999257b3bfe10b1d150df.tar.xz freeipa-1c4e4b3e141996ad89d999257b3bfe10b1d150df.zip |
Add function to retrieve a short list of attributes to make ipa-adddelegation
easier to use.
-rw-r--r-- | ipa-admintools/ipa-adddelegation | 10 | ||||
-rw-r--r-- | ipa-admintools/man/ipa-adddelegation.1 | 14 | ||||
-rw-r--r-- | ipa-python/ipaclient.py | 7 | ||||
-rw-r--r-- | ipa-python/rpcclient.py | 15 | ||||
-rw-r--r-- | ipa-server/xmlrpc-server/funcs.py | 7 | ||||
-rw-r--r-- | ipa-server/xmlrpc-server/ipaxmlrpc.py | 1 |
6 files changed, 49 insertions, 5 deletions
diff --git a/ipa-admintools/ipa-adddelegation b/ipa-admintools/ipa-adddelegation index 62b4b96e..5b5a34de 100644 --- a/ipa-admintools/ipa-adddelegation +++ b/ipa-admintools/ipa-adddelegation @@ -45,6 +45,8 @@ def parse_options(): help="The source group name") parser.add_option("-t", "--target", dest="target", help="The target group name") + parser.add_option("-l", "--list", dest="list", action="store_true", + help="List common attributes (this is not an exhaustive list)") parser.add_option("--usage", action="store_true", help="Program usage") @@ -57,6 +59,14 @@ def main(): options, args = parse_options() + if options.list: + client = ipaclient.IPAClient() + list = client.get_all_attrs() + + for x in list: + print x + return 0 + if len(args) != 2: print "args is %s" % len(args) usage() diff --git a/ipa-admintools/man/ipa-adddelegation.1 b/ipa-admintools/man/ipa-adddelegation.1 index 5eaba52a..5a269646 100644 --- a/ipa-admintools/man/ipa-adddelegation.1 +++ b/ipa-admintools/man/ipa-adddelegation.1 @@ -27,24 +27,28 @@ ipa\-adddelegation [\fIOPTION\fR]... \fIname\fR .SH "DESCRIPTION" Adds a delegation named \fIname\fR. -A delegation is used to grant access to certain attributes from one group to another. +A delegation is used to grant write access to certain attributes from one group to another. -For example, a secretary group may be granted access to modify the phone attribute of all users in a manager's group. +For example, a secretary group may be granted write access to modify the phone attribute of all users in a manager's group. .SH "OPTIONS" .TP \fB\-a\fR, \fB\-\-attributes\fR=\fIATTRIBUTES\fR A comma\-separated list of the the \f[SM]attributes\fR that may be written by the source group. - +.TP +\fB\-l\fR +Provide a list of common attribute names. This is not an exhaustive list. .TP \fB\-s\fR, \fB\-\-source\fR=\fISOURCE\fR The name of the group that is being granted write permission. - .TP \fB\-t\fR, \fB\-\-target\fR=\fITARGET\fR The name of the group that will be written to. - .PP All arguments are mandatory. +.SH "EXAMPLES" +.TP +ipa\-adddelegation \-a telephonenumber,facsimiletelephonenumber,mobile \-s secretaries \-t everyone phones +Create a delegation named phones that will let anyone in the secretaries group edit the phone numbers of anyone in the group everyone. .SH "EXIT STATUS" 0 if the delegation was added successfully diff --git a/ipa-python/ipaclient.py b/ipa-python/ipaclient.py index bd1fb235..c5377f3a 100644 --- a/ipa-python/ipaclient.py +++ b/ipa-python/ipaclient.py @@ -321,6 +321,13 @@ class IPAClient: return self.transport.attrs_to_labels(attrs) + def get_all_attrs(self): + """We have a list of hardcoded attributes -> readable labels. Return + that complete list if someone wants it. + """ + + return self.transport.get_all_attrs() + def group_members(self, groupdn, attr_list): """Do a memberOf search of groupdn and return the attributes in attr_list (an empty list returns everything).""" diff --git a/ipa-python/rpcclient.py b/ipa-python/rpcclient.py index c993ac99..32249fd3 100644 --- a/ipa-python/rpcclient.py +++ b/ipa-python/rpcclient.py @@ -579,6 +579,21 @@ class RPCClient: return ipautil.unwrap_binary_data(result) + def get_all_attrs(self, opts=None): + """We have a list of hardcoded attributes -> readable labels. Return + that complete list if someone wants it. + """ + + server = self.setup_server() + try: + result = server.get_all_attrs() + except xmlrpclib.Fault, fault: + raise ipaerror.gen_exception(fault.faultCode, fault.faultString) + except socket.error, (value, msg): + raise xmlrpclib.Fault(value, msg) + + return ipautil.unwrap_binary_data(result) + def group_members(self, groupdn, attr_list=None): """Do a memberOf search of groupdn and return the attributes in attr_list (an empty list returns everything).""" diff --git a/ipa-server/xmlrpc-server/funcs.py b/ipa-server/xmlrpc-server/funcs.py index c7a1f961..a4ebfcde 100644 --- a/ipa-server/xmlrpc-server/funcs.py +++ b/ipa-server/xmlrpc-server/funcs.py @@ -1625,6 +1625,13 @@ class IPAServer: return label_list + def get_all_attrs(self, opts=None): + """We have a list of hardcoded attributes -> readable labels. Return + that complete list if someone wants it. + """ + + return attrs.attr_label_list + def group_members(self, groupdn, attr_list, opts=None): """Do a memberOf search of groupdn and return the attributes in attr_list (an empty list returns everything).""" diff --git a/ipa-server/xmlrpc-server/ipaxmlrpc.py b/ipa-server/xmlrpc-server/ipaxmlrpc.py index 7752b258..e901aa6d 100644 --- a/ipa-server/xmlrpc-server/ipaxmlrpc.py +++ b/ipa-server/xmlrpc-server/ipaxmlrpc.py @@ -358,6 +358,7 @@ def handler(req, profiling=False): h.register_function(f.update_group) h.register_function(f.delete_group) h.register_function(f.attrs_to_labels) + h.register_function(f.get_all_attrs) h.register_function(f.group_members) h.register_function(f.get_ipa_config) h.register_function(f.update_ipa_config) |