Skip to content

Commit

Permalink
rename model fields
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Jun 11, 2024
1 parent db3d7cb commit 307d8b8
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 4.2.13 on 2024-06-10 17:56

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
(
"accounts",
"0037_role_can_manage_servertasks_role_can_run_servercli_and_more",
),
]

operations = [
migrations.RenameField(
model_name="role",
old_name="can_manage_servertasks",
new_name="can_run_server_scripts",
),
migrations.RenameField(
model_name="role",
old_name="can_run_servercli",
new_name="can_use_webterm",
),
migrations.RemoveField(
model_name="role",
name="can_run_servertasks",
),
migrations.RemoveField(
model_name="role",
name="can_view_servertasks",
),
]
6 changes: 2 additions & 4 deletions api/tacticalrmm/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ class Role(BaseAuditModel):
can_run_urlactions = models.BooleanField(default=False)
can_view_customfields = models.BooleanField(default=False)
can_manage_customfields = models.BooleanField(default=False)
can_view_servertasks = models.BooleanField(default=False)
can_manage_servertasks = models.BooleanField(default=False)
can_run_servertasks = models.BooleanField(default=False)
can_run_servercli = models.BooleanField(default=False)
can_run_server_scripts = models.BooleanField(default=False)
can_use_webterm = models.BooleanField(default=False)

# checks
can_list_checks = models.BooleanField(default=False)
Expand Down
2 changes: 1 addition & 1 deletion api/tacticalrmm/core/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def connect(self):
return

if self.user.block_dashboard_login or not _has_perm(
self.user, "can_run_servercli"
self.user, "can_use_webterm"
):
self.close(4401)
return
Expand Down
6 changes: 3 additions & 3 deletions api/tacticalrmm/core/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ def has_permission(self, r, view) -> bool:
return _has_perm(r, "can_manage_customfields")


class RunServerTaskPerms(permissions.BasePermission):
class RunServerScriptPerms(permissions.BasePermission):
def has_permission(self, r, view) -> bool:
return _has_perm(r, "can_run_servertasks")
return _has_perm(r, "can_run_server_scripts")


class WebTerminalPerms(permissions.BasePermission):
def has_permission(self, r, view) -> bool:
return _has_perm(r, "can_run_servercli")
return _has_perm(r, "can_use_webterm")
4 changes: 2 additions & 2 deletions api/tacticalrmm/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
CustomFieldPerms,
ServerMaintPerms,
URLActionPerms,
RunServerTaskPerms,
RunServerScriptPerms,
WebTerminalPerms,
)
from .serializers import (
Expand Down Expand Up @@ -462,7 +462,7 @@ def post(self, request):


class TestRunServerScript(APIView):
permission_classes = [IsAuthenticated, RunServerTaskPerms]
permission_classes = [IsAuthenticated, RunServerScriptPerms]

def post(self, request):
core: CoreSettings = CoreSettings.objects.first() # type: ignore
Expand Down

0 comments on commit 307d8b8

Please sign in to comment.