diff --git a/frontend/src/views/FlowEditorView.vue b/frontend/src/views/FlowEditorView.vue index 03e3b04..dd6b917 100644 --- a/frontend/src/views/FlowEditorView.vue +++ b/frontend/src/views/FlowEditorView.vue @@ -4,11 +4,22 @@
-

Visual Flow Editor

+
+

Visual Flow Editor

+ + {{ currentFlow.name }} (#{{ currentFlow.id }}) + +

Design automation DAGs with Decision branching, Loops, and Subflows

-
+
+
- +
+ +
+
+ Saved Flows + + {{ flowList.length }} + +
+
+
+
+
{{ flow.name }}
+
+ {{ flow.trigger_type || 'manual' }} • {{ flow.trigger_object || 'Any' }} +
+
+ → +
+
+ {{ isLoadingFlows ? 'Loading flows...' : 'No workflows found.' }} +
+
+
+
+ + +
+
+
+

Create New Flow

+ +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+
diff --git a/openforce/permissions.py b/openforce/permissions.py index 50e81e9..ee87c88 100644 --- a/openforce/permissions.py +++ b/openforce/permissions.py @@ -22,6 +22,10 @@ class ScopedOwnerAccessPermission(permissions.BasePermission): created_by = getattr(obj, 'created_by', None) if created_by is not None: return created_by == user + else: + # System-level or unassigned flow definition / shared template + if hasattr(obj, 'graph') or obj.__class__.__name__ == 'FlowDefinition': + return True # In CustomFieldDefinition, check custom_object's creator custom_obj = getattr(obj, 'custom_object', None) if custom_obj is not None: diff --git a/workflows/views.py b/workflows/views.py index 8cf3ffa..ab9ccfe 100644 --- a/workflows/views.py +++ b/workflows/views.py @@ -20,11 +20,11 @@ class FlowDefinitionViewSet(viewsets.ModelViewSet): qs = super().get_queryset() user = self.request.user if not user or not user.is_authenticated: - return qs + return qs.none() if user.is_superuser or user.is_staff: return qs if hasattr(FlowDefinition, 'created_by'): - return qs.filter(created_by=user) + return qs.filter(models.Q(created_by=user) | models.Q(created_by__isnull=True)) return qs def perform_create(self, serializer):