add list roles to accounts views
@@ -6,7 +6,8 @@ from tacticalrmm.permissions import _has_perm
class AccountsPerms(permissions.BasePermission):
def has_permission(self, r, view):
if r.method == "GET":
- return True
+ return _has_perm(r, "can_list_accounts")
+ else:
# allow users to reset their own password/2fa see issue #686
base_path = "/accounts/users/"
@@ -29,12 +30,14 @@ class AccountsPerms(permissions.BasePermission):
class RolesPerms(permissions.BasePermission):
def has_permission(self, r, view):
if r.method == "GET":
- return True
-
+ return _has_perm(r, "can_list_roles")
+ else:
return _has_perm(r, "can_manage_roles")
class APIKeyPerms(permissions.BasePermission):
def has_permission(self, r, view):
-
+ if r.method == "GET":
+ return _has_perm(r, "can_list_api_keys")
+ else:
return _has_perm(r, "can_manage_api_keys")
