django-rest-framework/setup.cfg
David Smith 4aea8dd65a
Change semantic of OR of two permission classes (#7522)
* Change semantic of OR of two permission classes

The original semantic of OR is defined as: the request pass either of the two has_permission() check, and pass either of the two has_object_permission() check, which could lead to situations that a request passes has_permission() but fails on has_object_permission() of Permission Class A, fails has_permission() but passes has_object_permission() of Permission Class B, passes the OR permission check. This should not be the desired permission check semantic in applications, because such a request should fail on either Permission Class (on Django object permission) alone, but passes the OR or the two.

My code fix this by changing the semantic so that the request has to pass either class's has_permission() and has_object_permission() to get the Django object permission of the OR check.

* Update rest_framework/permissions.py

* Update setup.cfg

Co-authored-by: Mark Yu <markyu98@outlook.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-09-21 12:19:33 +01:00

30 lines
627 B
INI

[metadata]
license_files = LICENSE.md
[tool:pytest]
addopts=--tb=short --strict-markers -ra
[flake8]
ignore = E501,W503,W504
banned-modules = json = use from rest_framework.utils import json!
[isort]
skip=.tox
atomic=true
multi_line_output=5
extra_standard_library=types
known_third_party=pytest,_pytest,django,pytz,uritemplate
known_first_party=rest_framework,tests
[coverage:run]
# NOTE: source is ignored with pytest-cov (but uses the same).
source = .
include = rest_framework/*,tests/*
branch = 1
[coverage:report]
include = rest_framework/*,tests/*
exclude_lines =
pragma: no cover
raise NotImplementedError