user listing working again for admins
This commit is contained in:
parent
59e26ea9b1
commit
9984ff5aee
2 changed files with 20 additions and 12 deletions
|
@ -28,11 +28,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr py:for="user in sorted(users)">
|
<tr py:for="person in people">
|
||||||
<td><a href="${tg.url('/user/view/%s' % user)}">${user}</a></td>
|
<td><a href="${tg.url('/user/view/%s' % person.username)}">${person.username}</a></td>
|
||||||
<td>
|
<td>
|
||||||
<span py:if="claDone[user]" class="approved">${_('CLA Done')}</span>
|
<span py:if="cla_done_group in person.memberships" class="approved">${_('CLA Done')}</span>
|
||||||
<span py:if="not claDone[user]" class="unapproved">${_('CLA Not Done')}</span>
|
<span py:if="not cla_done_group in person.memberships" class="unapproved">${_('CLA Not Done')}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import turbogears
|
import turbogears
|
||||||
from turbogears import controllers, expose, paginate, identity, redirect, widgets, validate, validators, error_handler
|
from turbogears import controllers, expose, paginate, identity, redirect, widgets, validate, validators, error_handler
|
||||||
from turbogears.database import session
|
from turbogears.database import session
|
||||||
|
import cherrypy
|
||||||
|
|
||||||
import ldap
|
import ldap
|
||||||
|
|
||||||
|
@ -135,6 +136,11 @@ class User(controllers.Controller):
|
||||||
'''
|
'''
|
||||||
turbogears.redirect('/user/view/%s' % turbogears.identity.current.user_name)
|
turbogears.redirect('/user/view/%s' % turbogears.identity.current.user_name)
|
||||||
|
|
||||||
|
def jsonRequest(self):
|
||||||
|
return 'tg_format' in cherrypy.request.params and \
|
||||||
|
cherrypy.request.params['tg_format'] == 'json'
|
||||||
|
|
||||||
|
|
||||||
@expose(template="fas.templates.error")
|
@expose(template="fas.templates.error")
|
||||||
def error(self, tg_errors=None):
|
def error(self, tg_errors=None):
|
||||||
'''Show a friendly error message'''
|
'''Show a friendly error message'''
|
||||||
|
@ -222,17 +228,19 @@ class User(controllers.Controller):
|
||||||
return dict(target=target)
|
return dict(target=target)
|
||||||
|
|
||||||
@identity.require(turbogears.identity.in_group("accounts")) #TODO: Use auth.py
|
@identity.require(turbogears.identity.in_group("accounts")) #TODO: Use auth.py
|
||||||
@expose(template="fas.templates.user.list")
|
@expose(template="fas.templates.user.list", allow_json=True)
|
||||||
def list(self, search="a*"):
|
def list(self, search="a*"):
|
||||||
'''List users
|
'''List users
|
||||||
'''
|
'''
|
||||||
people = People.query.filter(People.username.like('%%%s%%' % username))
|
re_search = re.sub(r'\*', r'%', search).lower()
|
||||||
try:
|
people = People.query.filter(People.username.like(re_search)).order_by('username')
|
||||||
people[0]
|
if people.count() < 0:
|
||||||
except:
|
turbogears.flash(_("No Users found matching '%s'") % search)
|
||||||
turbogears.flash(_("No users found matching '%s'") % search)
|
if self.jsonRequest():
|
||||||
people = []
|
return ({'users': users})
|
||||||
return dict(users=users, search=search)
|
cla_done_group = Groups.by_name('cla_done')
|
||||||
|
|
||||||
|
return dict(people=people, search=search, cla_done_group=cla_done_group)
|
||||||
|
|
||||||
@expose(template='fas.templates.user.new')
|
@expose(template='fas.templates.user.new')
|
||||||
def new(self):
|
def new(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue