mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-18 19:32:24 -06:00
* Fixes: #16292 - Properly restrict GraphQL queries for querys with pk set * Update netbox/netbox/settings.py * Apply schema adaptations across all apps * Extend GraphQL API tests --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -1,21 +1,15 @@
|
||||
from typing import List
|
||||
|
||||
import strawberry
|
||||
import strawberry_django
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import Group
|
||||
from users import models
|
||||
from .types import *
|
||||
|
||||
|
||||
@strawberry.type
|
||||
@strawberry.type(name="Query")
|
||||
class UsersQuery:
|
||||
@strawberry.field
|
||||
def group(self, id: int) -> GroupType:
|
||||
return models.Group.objects.get(pk=id)
|
||||
group: GroupType = strawberry_django.field()
|
||||
group_list: List[GroupType] = strawberry_django.field()
|
||||
|
||||
@strawberry.field
|
||||
def user(self, id: int) -> UserType:
|
||||
return models.User.objects.get(pk=id)
|
||||
user: UserType = strawberry_django.field()
|
||||
user_list: List[UserType] = strawberry_django.field()
|
||||
|
||||
Reference in New Issue
Block a user