~rvb/maas/transaction-1.7-bug-1409852

« back to all changes in this revision

Viewing changes to src/maasserver/api/node_group_interfaces.py

merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
    @operation(idempotent=True)
62
62
    def list(self, request, uuid):
63
63
        """List of NodeGroupInterfaces of a NodeGroup."""
 
64
        # Any user has read-only access to nodegroup interfaces.
64
65
        nodegroup = get_object_or_404(NodeGroup, uuid=uuid)
65
 
        if not request.user.is_superuser:
66
 
            check_nodegroup_access(request, nodegroup)
67
66
        return NodeGroupInterface.objects.filter(nodegroup=nodegroup)
68
67
 
69
68
    @operation(idempotent=False)
141
140
 
142
141
    def read(self, request, uuid, name):
143
142
        """List of NodeGroupInterfaces of a NodeGroup."""
144
 
        return self.get_interface(request, uuid, name)
 
143
        # Read-only access is allowed to any user.
 
144
        nodegroup = get_object_or_404(NodeGroup, uuid=uuid)
 
145
        return get_object_or_404(
 
146
            NodeGroupInterface, nodegroup=nodegroup, name=name)
145
147
 
146
148
    def update(self, request, uuid, name):
147
149
        """Update a specific NodeGroupInterface.