diff options
Diffstat (limited to 'ipa-server')
-rw-r--r-- | ipa-server/ipa-gui/ipagui/controllers.py | 14 | ||||
-rw-r--r-- | ipa-server/ipa-gui/ipagui/templates/usershow.kid | 15 | ||||
-rw-r--r-- | ipa-server/xmlrpc-server/funcs.py | 18 | ||||
-rw-r--r-- | ipa-server/xmlrpc-server/ipaxmlrpc.py | 1 |
4 files changed, 45 insertions, 3 deletions
diff --git a/ipa-server/ipa-gui/ipagui/controllers.py b/ipa-server/ipa-gui/ipagui/controllers.py index 11ce48a73..14213461c 100644 --- a/ipa-server/ipa-gui/ipagui/controllers.py +++ b/ipa-server/ipa-gui/ipagui/controllers.py @@ -252,8 +252,20 @@ class Root(controllers.RootController): try: user = client.get_user_by_uid(uid, user_fields) user_groups = client.get_groups_by_member(user.dn, ['cn']) + user_reports = client.get_users_by_manager(user.dn, + ['givenname', 'sn', 'uid']) + + user_manager = None + try: + if user.manager: + user_manager = client.get_user_by_dn(user.manager, + ['givenname', 'sn', 'uid']) + except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND): + pass + return dict(user=user.toDict(), fields=forms.user.UserFields(), - user_groups=user_groups) + user_groups=user_groups, user_reports=user_reports, + user_manager=user_manager) except ipaerror.IPAError, e: turbogears.flash("User show failed: " + str(e)) raise turbogears.redirect("/") diff --git a/ipa-server/ipa-gui/ipagui/templates/usershow.kid b/ipa-server/ipa-gui/ipagui/templates/usershow.kid index 5092a427f..a71f683df 100644 --- a/ipa-server/ipa-gui/ipagui/templates/usershow.kid +++ b/ipa-server/ipa-gui/ipagui/templates/usershow.kid @@ -78,6 +78,15 @@ else: </th> <td>${user.get("telephonenumber")}</td> </tr> + <tr py:if='user_manager'> + <th> + Manager: + </th> + <td> + <a href="${tg.url('/usershow', uid=user_manager.uid)}" + >${user_manager.givenname} ${user_manager.sn}</a> + </td> + </tr> </table> <div class="formsection">Account Status</div> @@ -90,6 +99,12 @@ else: </tr> </table> + <div class="formsection" py:if='len(user_reports) > 0'>Direct Reports</div> + <div py:for="report in user_reports"> + <a href="${tg.url('/usershow', uid=report.uid)}" + >${report.givenname} ${report.sn}</a> + </div> + <div class="formsection">Groups</div> <div py:for="group in user_groups"> <a href="${tg.url('/groupshow', cn=group.cn)}">${group.cn}</a> diff --git a/ipa-server/xmlrpc-server/funcs.py b/ipa-server/xmlrpc-server/funcs.py index 2f9606d0f..d226ac863 100644 --- a/ipa-server/xmlrpc-server/funcs.py +++ b/ipa-server/xmlrpc-server/funcs.py @@ -308,7 +308,18 @@ class IPAServer: filter = "(objectClass=*)" return self.__get_entry(dn, filter, sattrs, opts) - + + def get_users_by_manager (self, manager_dn, sattrs=None, opts=None): + """Gets the users that report to a particular manager. + """ + + filter = "(&(objectClass=person)(manager=%s))" % manager_dn + + try: + return self.__get_list(self.basedn, filter, sattrs, opts) + except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND): + return [] + def add_user (self, user, user_container=None, opts=None): """Add a user in LDAP. Takes as input a dict where the key is the attribute name and the value is either a string or in the case @@ -601,7 +612,10 @@ class IPAServer: filter = "(&(objectClass=posixGroup)(uniqueMember=%s))" % member_dn - return self.__get_list(self.basedn, filter, sattrs, opts) + try: + return self.__get_list(self.basedn, filter, sattrs, opts) + except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND): + return [] def add_group (self, group, group_container=None, opts=None): """Add a group in LDAP. Takes as input a dict where the key is the diff --git a/ipa-server/xmlrpc-server/ipaxmlrpc.py b/ipa-server/xmlrpc-server/ipaxmlrpc.py index baeb50707..aa9044642 100644 --- a/ipa-server/xmlrpc-server/ipaxmlrpc.py +++ b/ipa-server/xmlrpc-server/ipaxmlrpc.py @@ -316,6 +316,7 @@ def handler(req, profiling=False): h = ModXMLRPCRequestHandler() h.register_function(f.get_user_by_uid) h.register_function(f.get_user_by_dn) + h.register_function(f.get_users_by_manager) h.register_function(f.add_user) h.register_function(f.get_add_schema) h.register_function(f.get_all_users) |