Skip to content

Commit

Permalink
Merge pull request #146 from salopensource/searchinvestigations
Browse files Browse the repository at this point in the history
!= searches could sneak through and not be negated
  • Loading branch information
grahamgilbert authored Oct 5, 2017
2 parents 90d8345 + f0c3ff2 commit ee2d7ce
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sal/version.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>version</key>
<string>3.2.4.976</string>
<string>3.2.5.984</string>
</dict>
</plist>
16 changes: 14 additions & 2 deletions search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,32 @@ def search_machines(search_id, machines, full=False):
querystring = {
'%s%s' % (search_row.search_field, operator): search_row.search_term
}
if operator != '':
q_object = Q(**querystring)
else:
q_object = ~Q(**querystring)
elif search_row.search_models == 'Facter':
model = Fact
prepend = 'facts__'
querystring = {
'facts__fact_name': search_row.search_field,
'facts__fact_data%s' % (operator): search_row.search_term
}
if operator != '':
q_object = Q(**querystring)
else:
q_object = ~Q(**querystring)

elif search_row.search_models == 'Condition':
model = Condition
querystring = {
'conditions__condition_name': search_row.search_field,
'conditions__condition_data%s' % (operator): search_row.search_term
}
if operator != '':
q_object = Q(**querystring)
else:
q_object = ~Q(**querystring)


elif search_row.search_models == 'Application Inventory':
Expand All @@ -149,12 +161,11 @@ def search_machines(search_id, machines, full=False):
'inventoryitem__application__%s%s' % (search_field, operator): search_row.search_term
}

if model != None:
if operator != '':
q_object = Q(**querystring)

else:
q_object = ~Q(**querystring)

elif search_row.search_models == 'External Script':
# It must be an exernal thingie if we're here
model = PluginScriptRow
Expand Down Expand Up @@ -210,6 +221,7 @@ def search_machines(search_id, machines, full=False):
queries = row_queries

search_group_counter = search_group_counter + 1
print queries

if full == True:
machines = machines.filter(queries).distinct()
Expand Down
2 changes: 1 addition & 1 deletion set_build_no.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

current_version="3.2.4"
current_version="3.2.5"
pushd `dirname $0` > /dev/null
SCRIPTPATH=`pwd`

Expand Down

0 comments on commit ee2d7ce

Please sign in to comment.