add Find: Group to Manage Users, #1878

This commit is contained in:
j 2014-09-30 14:26:14 +02:00
parent 3cdb0e23cc
commit 511858804a
3 changed files with 8 additions and 4 deletions

View file

@ -9,6 +9,8 @@ def parseCondition(condition, user):
k = {
'email': 'user__email',
'user': 'username',
'group': 'user__groups__name',
'groups': 'user__groups__name',
}.get(k, k)
v = condition['value']
op = condition.get('operator')

View file

@ -477,7 +477,7 @@ def findUsers(request):
}
possible query keys:
username, email, lastLogin, browser
username, email, lastLogin, browser, groups
returns {
items: [

View file

@ -65,7 +65,8 @@ pandora.ui.usersDialog = function() {
items: [
{id: 'all', title: Ox._('Find: All')},
{id: 'username', title: Ox._('Find: Username')},
{id: 'email', title: Ox._('Find: E-Mail Address')}
{id: 'email', title: Ox._('Find: E-Mail Address')},
{id: 'group', title: Ox._('Find: Group')}
],
overlap: 'right',
type: 'image'
@ -964,8 +965,9 @@ pandora.ui.usersDialog = function() {
query = {
conditions: value
? [].concat(
key != 'email' ? [{key: 'username', value: value, operator: '='}] : [],
key != 'username' ? [{key: 'email', value: value, operator: '='}] : []
Ox.contains(['username', 'all'], key) ? [{key: 'username', value: value, operator: '='}] : [],
Ox.contains(['email', 'all'], key) ? [{key: 'email', value: value, operator: '='}] : [],
Ox.contains(['group', 'all'], key) ? [{key: 'group', value: value, operator: '='}] : []
)
: [].concat(
!guests ? [{key: 'level', value: 'guest', operator: '!='}] : [],