| 64 | queryset = ProcessingNode.objects.all() |
| 65 | |
| 66 | def get(self, request): |
| 67 | |
| 68 | nodes = get_objects_for_user(request.user, 'view_processingnode', ProcessingNode, accept_global_perms=False) |
| 69 | common_options = [] |
| 70 | |
| 71 | for node in nodes: |
| 72 | # Skip offline nodes |
| 73 | if not node.is_online(): |
| 74 | continue |
| 75 | |
| 76 | # First? Just populate |
| 77 | if len(common_options) == 0 and len(node.available_options) > 0: |
| 78 | common_options = node.available_options |
| 79 | else: |
| 80 | # Remove all options that are in common_options, |
| 81 | # but that are not in node.available_options |
| 82 | for common_option in common_options: |
| 83 | found = False |
| 84 | for option in node.available_options: |
| 85 | if common_option['name'] == option['name']: |
| 86 | found = True |
| 87 | break |
| 88 | |
| 89 | # Mark for deletion |
| 90 | if not found: |
| 91 | common_option['_delete'] = True |
| 92 | |
| 93 | common_options = [co for co in common_options if not '_delete' in co] |
| 94 | |
| 95 | return Response(common_options) |