Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perform proper authorisation checks on GraphQL queries #378

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 16 additions & 40 deletions netbox_dns/graphql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,79 +25,55 @@
)


@strawberry.type
@strawberry.type(name="Query")
class NetBoxDNSNameServerQuery:
@strawberry.field
def netbox_dns_nameserver(self, id: int) -> NetBoxDNSNameServerType:
return NameServer.objects.get(pk=id)

netbox_dns_nameserver: NetBoxDNSNameServerType = strawberry_django.field()
netbox_dns_nameserver_list: List[NetBoxDNSNameServerType] = (
strawberry_django.field()
)


@strawberry.type
@strawberry.type(name="Query")
class NetBoxDNSViewQuery:
@strawberry.field
def netbox_dns_view(self, id: int) -> NetBoxDNSViewType:
return View.objects.get(pk=id)

netbox_dns_view: NetBoxDNSViewType = strawberry_django.field()
netbox_dns_view_list: List[NetBoxDNSViewType] = strawberry_django.field()


@strawberry.type
@strawberry.type(name="Query")
class NetBoxDNSZoneQuery:
@strawberry.field
def netbox_dns_zone(self, id: int) -> NetBoxDNSZoneType:
return Zone.objects.get(pk=id)

netbox_dns_zone: NetBoxDNSZoneType = strawberry_django.field()
netbox_dns_zone_list: List[NetBoxDNSZoneType] = strawberry_django.field()


@strawberry.type
@strawberry.type(name="Query")
class NetBoxDNSRecordQuery:
@strawberry.field
def netbox_dns_record(self, id: int) -> NetBoxDNSRecordType:
return Record.objects.get(pk=id)

netbox_dns_record: NetBoxDNSRecordType = strawberry_django.field()
netbox_dns_record_list: List[NetBoxDNSRecordType] = strawberry_django.field()


@strawberry.type
@strawberry.type(name="Query")
class NetBoxDNSContactQuery:
@strawberry.field
def netbox_dns_contact(self, id: int) -> NetBoxDNSContactType:
return Contact.objects.get(pk=id)

netbox_dns_contact: NetBoxDNSContactType = strawberry_django.field()
netbox_dns_contact_list: List[NetBoxDNSContactType] = strawberry_django.field()


@strawberry.type
@strawberry.type(name="Query")
class NetBoxDNSRegistrarQuery:
@strawberry.field
def netbox_dns_registrar(self, id: int) -> NetBoxDNSRegistrarType:
return Registrar.objects.get(pk=id)

netbox_dns_registrar: NetBoxDNSRegistrarType = strawberry_django.field()
netbox_dns_registrar_list: List[NetBoxDNSRegistrarType] = strawberry_django.field()


@strawberry.type
@strawberry.type(name="Query")
class NetBoxDNSZoneTemplateQuery:
@strawberry.field
def netbox_dns_zone_template(self, id: int) -> NetBoxDNSZoneTemplateType:
return ZoneTemplate.objects.get(pk=id)

netbox_dns_zone_template: NetBoxDNSZoneTemplateType = strawberry_django.field()
netbox_dns_zone_template_list: List[NetBoxDNSZoneTemplateType] = (
strawberry_django.field()
)


@strawberry.type
@strawberry.type(name="Query")
class NetBoxDNSRecordTemplateQuery:
@strawberry.field
def netbox_dns_record_template(self, id: int) -> NetBoxDNSRecordTemplateType:
return RecordTemplate.objects.get(pk=id)

netbox_dns_record_template: NetBoxDNSRecordTemplateType = strawberry_django.field()
netbox_dns_record_template_list: List[NetBoxDNSRecordTemplateType] = (
strawberry_django.field()
)