mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-13 19:18:16 -06:00
15582 check permissions on specific object when sync request
This commit is contained in:
parent
b7668fbfc3
commit
1449cda390
@ -37,6 +37,11 @@ class DataSourceViewSet(NetBoxModelViewSet):
|
||||
raise PermissionDenied("Syncing data sources requires the core.sync_datasource permission.")
|
||||
|
||||
datasource = get_object_or_404(DataSource, pk=pk)
|
||||
|
||||
# have to check perms again against this specific object as there could be constraints
|
||||
if not request.user.has_perm('core.sync_datasource', datasource):
|
||||
raise PermissionDenied("User does not have the core.sync_datasource permission for this object.")
|
||||
|
||||
datasource.enqueue_sync_job(request)
|
||||
serializer = serializers.DataSourceSerializer(datasource, context={'request': request})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user