-
-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
113 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -403,6 +403,7 @@ def test_send_raw_cmd(self, mock_ret): | |
"cmd": "ipconfig", | ||
"shell": "cmd", | ||
"timeout": 30, | ||
"run_as_user": False, | ||
} | ||
mock_ret.return_value = "nt authority\\system" | ||
r = self.client.post(url, data, format="json") | ||
|
@@ -538,6 +539,7 @@ def test_run_script(self, run_script, email_task): | |
"output": "wait", | ||
"args": [], | ||
"timeout": 15, | ||
"run_as_user": False, | ||
} | ||
|
||
r = self.client.post(url, data, format="json") | ||
|
@@ -547,7 +549,12 @@ def test_run_script(self, run_script, email_task): | |
raise AgentHistory.DoesNotExist | ||
|
||
run_script.assert_called_with( | ||
scriptpk=script.pk, args=[], timeout=18, wait=True, history_pk=hist.pk | ||
scriptpk=script.pk, | ||
args=[], | ||
timeout=18, | ||
wait=True, | ||
history_pk=hist.pk, | ||
run_as_user=False, | ||
) | ||
run_script.reset_mock() | ||
|
||
|
@@ -559,6 +566,7 @@ def test_run_script(self, run_script, email_task): | |
"timeout": 15, | ||
"emailMode": "default", | ||
"emails": ["[email protected]", "[email protected]"], | ||
"run_as_user": False, | ||
} | ||
r = self.client.post(url, data, format="json") | ||
self.assertEqual(r.status_code, 200) | ||
|
@@ -568,6 +576,7 @@ def test_run_script(self, run_script, email_task): | |
nats_timeout=18, | ||
emails=[], | ||
args=["abc", "123"], | ||
run_as_user=False, | ||
) | ||
email_task.reset_mock() | ||
|
||
|
@@ -581,6 +590,7 @@ def test_run_script(self, run_script, email_task): | |
nats_timeout=18, | ||
emails=["[email protected]", "[email protected]"], | ||
args=["abc", "123"], | ||
run_as_user=False, | ||
) | ||
|
||
# test fire and forget | ||
|
@@ -589,6 +599,7 @@ def test_run_script(self, run_script, email_task): | |
"output": "forget", | ||
"args": ["hello", "world"], | ||
"timeout": 22, | ||
"run_as_user": True, | ||
} | ||
|
||
r = self.client.post(url, data, format="json") | ||
|
@@ -598,7 +609,11 @@ def test_run_script(self, run_script, email_task): | |
raise AgentHistory.DoesNotExist | ||
|
||
run_script.assert_called_with( | ||
scriptpk=script.pk, args=["hello", "world"], timeout=25, history_pk=hist.pk | ||
scriptpk=script.pk, | ||
args=["hello", "world"], | ||
timeout=25, | ||
history_pk=hist.pk, | ||
run_as_user=True, | ||
) | ||
run_script.reset_mock() | ||
|
||
|
@@ -613,6 +628,7 @@ def test_run_script(self, run_script, email_task): | |
"timeout": 22, | ||
"custom_field": custom_field.pk, | ||
"save_all_output": True, | ||
"run_as_user": False, | ||
} | ||
|
||
r = self.client.post(url, data, format="json") | ||
|
@@ -627,6 +643,7 @@ def test_run_script(self, run_script, email_task): | |
timeout=25, | ||
wait=True, | ||
history_pk=hist.pk, | ||
run_as_user=False, | ||
) | ||
run_script.reset_mock() | ||
|
||
|
@@ -644,6 +661,7 @@ def test_run_script(self, run_script, email_task): | |
"timeout": 22, | ||
"custom_field": custom_field.pk, | ||
"save_all_output": False, | ||
"run_as_user": False, | ||
} | ||
|
||
r = self.client.post(url, data, format="json") | ||
|
@@ -658,6 +676,7 @@ def test_run_script(self, run_script, email_task): | |
timeout=25, | ||
wait=True, | ||
history_pk=hist.pk, | ||
run_as_user=False, | ||
) | ||
run_script.reset_mock() | ||
|
||
|
@@ -677,6 +696,7 @@ def test_run_script(self, run_script, email_task): | |
"timeout": 22, | ||
"custom_field": custom_field.pk, | ||
"save_all_output": False, | ||
"run_as_user": False, | ||
} | ||
|
||
r = self.client.post(url, data, format="json") | ||
|
@@ -691,6 +711,7 @@ def test_run_script(self, run_script, email_task): | |
timeout=25, | ||
wait=True, | ||
history_pk=hist.pk, | ||
run_as_user=False, | ||
) | ||
run_script.reset_mock() | ||
|
||
|
@@ -707,6 +728,7 @@ def test_run_script(self, run_script, email_task): | |
"output": "note", | ||
"args": ["hello", "world"], | ||
"timeout": 22, | ||
"run_as_user": False, | ||
} | ||
|
||
r = self.client.post(url, data, format="json") | ||
|
@@ -721,6 +743,7 @@ def test_run_script(self, run_script, email_task): | |
timeout=25, | ||
wait=True, | ||
history_pk=hist.pk, | ||
run_as_user=False, | ||
) | ||
run_script.reset_mock() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
api/tacticalrmm/scripts/migrations/0018_script_run_as_user.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.0.6 on 2022-07-30 21:05 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('scripts', '0017_auto_20220311_0100'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='script', | ||
name='run_as_user', | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.