Permissions
摘要
In Django Rest Framework (DRF), permissions are a way to control access to views or APIs based on specific rules. Permissions define who is allowed to perform certain actions (like viewing, editing, or deleting data) and are a key part of DRF’s security system. Permissions are checked after authentication, so the request must already include valid credentials. Permissions are applied to a view or a viewset to determine if a particular user (or request) has the right to interact with the resource. If the user doesn’t have the necessary permissions, DRF will return a 403 Forbidden response. They are crucial for controlling access to your API and ensuring that only authorized users can perform specific actions on your resources. Together with authentication and throttling , permissions determine whether a request should be granted or denied access.