feat: Implement initial schema and add various API, service, and management command enhancements across the application.

This commit is contained in:
pacnpal
2026-01-01 15:13:01 -05:00
parent c95f99ca10
commit b243b17af7
413 changed files with 11164 additions and 17433 deletions

View File

@@ -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