forked from 0x2620/pandora
add Find: Group to Manage Users, #1878
This commit is contained in:
parent
3cdb0e23cc
commit
511858804a
3 changed files with 8 additions and 4 deletions
|
@ -9,6 +9,8 @@ def parseCondition(condition, user):
|
||||||
k = {
|
k = {
|
||||||
'email': 'user__email',
|
'email': 'user__email',
|
||||||
'user': 'username',
|
'user': 'username',
|
||||||
|
'group': 'user__groups__name',
|
||||||
|
'groups': 'user__groups__name',
|
||||||
}.get(k, k)
|
}.get(k, k)
|
||||||
v = condition['value']
|
v = condition['value']
|
||||||
op = condition.get('operator')
|
op = condition.get('operator')
|
||||||
|
|
|
@ -477,7 +477,7 @@ def findUsers(request):
|
||||||
}
|
}
|
||||||
|
|
||||||
possible query keys:
|
possible query keys:
|
||||||
username, email, lastLogin, browser
|
username, email, lastLogin, browser, groups
|
||||||
|
|
||||||
returns {
|
returns {
|
||||||
items: [
|
items: [
|
||||||
|
|
|
@ -65,7 +65,8 @@ pandora.ui.usersDialog = function() {
|
||||||
items: [
|
items: [
|
||||||
{id: 'all', title: Ox._('Find: All')},
|
{id: 'all', title: Ox._('Find: All')},
|
||||||
{id: 'username', title: Ox._('Find: Username')},
|
{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',
|
overlap: 'right',
|
||||||
type: 'image'
|
type: 'image'
|
||||||
|
@ -964,8 +965,9 @@ pandora.ui.usersDialog = function() {
|
||||||
query = {
|
query = {
|
||||||
conditions: value
|
conditions: value
|
||||||
? [].concat(
|
? [].concat(
|
||||||
key != 'email' ? [{key: 'username', value: value, operator: '='}] : [],
|
Ox.contains(['username', 'all'], key) ? [{key: 'username', value: value, operator: '='}] : [],
|
||||||
key != 'username' ? [{key: 'email', value: value, operator: '='}] : []
|
Ox.contains(['email', 'all'], key) ? [{key: 'email', value: value, operator: '='}] : [],
|
||||||
|
Ox.contains(['group', 'all'], key) ? [{key: 'group', value: value, operator: '='}] : []
|
||||||
)
|
)
|
||||||
: [].concat(
|
: [].concat(
|
||||||
!guests ? [{key: 'level', value: 'guest', operator: '!='}] : [],
|
!guests ? [{key: 'level', value: 'guest', operator: '!='}] : [],
|
||||||
|
|
Loading…
Reference in a new issue