mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-01-02 01:27:03 -05:00
feat: Implement initial schema and add various API, service, and management command enhancements across the application.
This commit is contained in:
@@ -88,7 +88,7 @@ class PermissionGuardAdapter:
|
||||
return False
|
||||
|
||||
# Check object permission if available
|
||||
if hasattr(permission, "has_object_permission"):
|
||||
if hasattr(permission, "has_object_permission"): # noqa: SIM102
|
||||
if not permission.has_object_permission(mock_request, None, instance):
|
||||
self._last_error_code = "OBJECT_PERMISSION_DENIED"
|
||||
return False
|
||||
@@ -318,9 +318,7 @@ class CanAssignModerationTasks(GuardMixin, permissions.BasePermission):
|
||||
# Moderators can only assign to themselves
|
||||
if user_role == "MODERATOR":
|
||||
# Check if they're trying to assign to themselves
|
||||
assignee_id = request.data.get("moderator_id") or request.data.get(
|
||||
"assigned_to"
|
||||
)
|
||||
assignee_id = request.data.get("moderator_id") or request.data.get("assigned_to")
|
||||
if assignee_id:
|
||||
return str(assignee_id) == str(request.user.id)
|
||||
return True
|
||||
@@ -362,7 +360,7 @@ class CanPerformBulkOperations(GuardMixin, permissions.BasePermission):
|
||||
# Add any admin-specific restrictions for bulk operations here
|
||||
# For example, admins might not be able to perform certain destructive operations
|
||||
operation_type = getattr(obj, "operation_type", None)
|
||||
if operation_type in ["DELETE_USERS", "PURGE_DATA"]:
|
||||
if operation_type in ["DELETE_USERS", "PURGE_DATA"]: # noqa: SIM103
|
||||
return False # Only superusers can perform these operations
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user