Python | Django Authorization

Last Updated :
Discuss
Comments

Question 1

Which class in DRF allows unauthenticated users to read data while restricting write operations to authorized users?

  • AllowAny

  • IsAdminUser

  • DjangoModelPermissionsOrAnonReadOnly

  • IsAuthenticatedOrReadOnly

Question 2

What method must be overridden when creating a custom object-level permission class in DRF?

  • has_permission() only

  • has_permission() and has_object_permission()

  • set_object_permission()

  • has_object_permission() only

Question 3

Which three permissions in Django’s built-in permissions system are automatically created for each model?

  • add, view, share

  • view, change, delete

  • add, change, delete

  • create, update, remove

Question 4

What happens if a user belongs to a group that has been assigned custom permissions?

  • The user gets no permissions unless explicitly set

  • The user inherits all permissions of that group

  • The user must re-authenticate to use group permissions

  • Group permissions override staff status

Question 5

Which permission class in DRF checks for model-level permissions and also uses object-level checks when configured?

  • DjangoObjectPermissions

  • IsAuthenticated

  • DjangoModelPermissions

  • ReadOnly

Question 6

Why is object-level permission filtering of list endpoints not applied automatically in DRF?

  • Because list endpoints always require authentication only

  • Because permissions apply only after data is sent

  • Because DRF disables permissions for lists

  • Because object-level permission checks aren’t called for queryset lists

Tags:

There are 6 questions to complete.

Take a part in the ongoing discussion