Skip to content

Commit daf6c8e

Browse files
committed
Fixes #7814: Fix restriction of user & group objects in GraphQL API queries
1 parent 9f8068e commit daf6c8e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/release-notes/version-3.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* [#7802](https://github.com/netbox-community/netbox/issues/7802) - Differentiate ID and VID columns in VLANs table
2323
* [#7808](https://github.com/netbox-community/netbox/issues/7808) - Fix reference values for content type under custom field import form
2424
* [#7809](https://github.com/netbox-community/netbox/issues/7809) - Add missing export template support for various models
25+
* [#7814](https://github.com/netbox-community/netbox/issues/7814) - Fix restriction of user & group objects in GraphQL API queries
2526

2627
---
2728

netbox/users/graphql/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Meta:
1919

2020
@classmethod
2121
def get_queryset(cls, queryset, info):
22-
return RestrictedQuerySet(model=Group)
22+
return RestrictedQuerySet(model=Group).restrict(info.context.user, 'view')
2323

2424

2525
class UserType(DjangoObjectType):
@@ -34,4 +34,4 @@ class Meta:
3434

3535
@classmethod
3636
def get_queryset(cls, queryset, info):
37-
return RestrictedQuerySet(model=User)
37+
return RestrictedQuerySet(model=User).restrict(info.context.user, 'view')

0 commit comments

Comments
 (0)