allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [15/26] git commit: [#7656] ticket:648 Display search results and small fixes
Date Fri, 19 Sep 2014 20:04:29 GMT
[#7656] ticket:648 Display search results and small fixes


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/caf12ce1
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/caf12ce1
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/caf12ce1

Branch: refs/heads/master
Commit: caf12ce1dbbcdddd37ba3b34e3f8326897aff4b9
Parents: 097c850
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue Sep 9 15:59:14 2014 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Sep 19 19:35:40 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/site_admin.py         |  3 ++-
 Allura/allura/lib/plugin.py                     | 10 ++++++++
 Allura/allura/model/auth.py                     |  3 ++-
 .../site_admin_search_users_results.html        | 24 +++++++++++++++++++-
 4 files changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/caf12ce1/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 40c69f2..b6fecd7 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -34,7 +34,7 @@ from allura.app import SitemapEntry
 from allura.lib import helpers as h
 from allura.lib import validators as v
 from allura.lib.decorators import require_post
-from allura.lib.plugin import SiteAdminExtension, ProjectRegistrationProvider
+from allura.lib.plugin import SiteAdminExtension, ProjectRegistrationProvider, AuthenticationProvider
 from allura.lib import search
 from allura.lib.security import require_access
 from allura.lib.widgets import form_fields as ffw
@@ -362,6 +362,7 @@ class SiteAdminController(object):
         add_fields = aslist(tg.config.get('search.user.additional_fields'), ',')
         r = self._search(M.User, fields, add_fields, q, f, page, limit, **kw)
         r['search_results_template'] = 'allura:templates/site_admin_search_users_results.html'
+        r['provider'] = AuthenticationProvider.get(request)
         return r
 
 

http://git-wip-us.apache.org/repos/asf/allura/blob/caf12ce1/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index ccdf62c..78aae92 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -288,6 +288,16 @@ class AuthenticationProvider(object):
         """Put here additional fields for user index in SOLR."""
         return {}
 
+    def details_links(self, user):
+        '''Return list of pairs (url, label) with details
+        about the user.
+        Links will show up at admin user search page.
+        '''
+        return [
+           (user.url(), 'Public profile'),
+           ('/nf/admin/user/%s' % user.username, 'Details/Edit'),
+        ]
+
 
 class LocalAuthenticationProvider(AuthenticationProvider):
 

http://git-wip-us.apache.org/repos/asf/allura/blob/caf12ce1/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 6cca818..7f99866 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -293,6 +293,7 @@ class User(MappedClass, ActivityNode, ActivityObject, SearchIndexable):
         fields = dict(
             id=self.index_id(),
             title='User %s' % self.username,
+            url_s=self.url(),
             type_s=self.type_s,
             username_s=self.username,
             email_addresses_t=' '.join(self.email_addresses),
@@ -311,7 +312,7 @@ class User(MappedClass, ActivityNode, ActivityObject, SearchIndexable):
             telnumbers_t=' '.join(self.get_pref('telnumbers')),
             skypeaccount_s=self.get_pref('skypeaccount'),
             webpages_t=' '.join(self.get_pref('webpages')),
-            skills_t=' '.join([s['skill'].fullpath for s in self.get_skills()]),
+            skills_t=' '.join([s['skill'].fullpath for s in self.get_skills() if s.get('skill')]),
             last_access_login_date_dt=self.last_access['login_date'],
             last_access_login_ip_s=self.last_access['login_ip'],
             last_access_login_ua_t=self.last_access['login_ua'],

http://git-wip-us.apache.org/repos/asf/allura/blob/caf12ce1/Allura/allura/templates/site_admin_search_users_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_search_users_results.html b/Allura/allura/templates/site_admin_search_users_results.html
index b73c5c4..ce9a8d0 100644
--- a/Allura/allura/templates/site_admin_search_users_results.html
+++ b/Allura/allura/templates/site_admin_search_users_results.html
@@ -1,7 +1,29 @@
 <tr>
+  <th>Username</th>
+  <th>Display name</th>
+  <th>Email</th>
+  <th>Registered</th>
+  <th>Disabled?</th>
+  {% for field in additional_fields %}
+  <th>{{ field }}</th>
+  {% endfor %}
+  <th>Details</th>
 </tr>
 
-{% for user in objects %}
+{% for u in objects %}
 <tr>
+  <td><a href="{{ u['url'] }}">{{ u['username'] }}</a></td>
+  <td>{{ u['display_name'] }}</td>
+  <td>{{ u['object'].get_pref('email_address') }}</td>
+  <td>{{ provider.user_registration_date(u['object']) }}</td>
+  <td>{{ u['disabled'] }}</td>
+  {% for field in additional_fields %}
+  <td>{{ u[field] }}</td>
+  {% endfor %}
+  <td>
+    {% for url, label in provider.details_links(u['object']) %}
+      <a href="{{ url }}">{{ label }}</a><br>
+    {% endfor %}
+  </td>
 </tr>
 {% endfor %}


Mime
View raw message