گسترش دادن¶
چیزی که یک لایه بالای بستهها نصب میکند - بستههای آغازین و یک سقف، همان کاری که clearance.roles میکند - backendی که آن را میخواند، و آنچه کتابخانه از یک شخص میپرسد. توضیحهای زیر از خود کد خوانده میشوند، و مثل کد به انگلیسیاند.
Limits
¶
No starting bundles, no ceiling: what a project without roles has.
starting_bundles
¶
The bundles user is given by what they are, not by being given them.
allowed
¶
The condition that a permission is within user's ceiling -
permission names the column holding its id in the query it joins.
within_ceiling
¶
The condition on the user model that a person's ceiling permits any of
permissions - everybody's, asked at once, for "who holds this?".
people_starting_with
¶
Everybody given any of bundles by what they are - for the safety rules.
bundles_started
¶
The bundles anybody is given by what they are - marked in the list of bundles.
describe
¶
What user is, in words - shown on their page in the admin site.
person_fields
¶
The fields of the user model that say what a person is. Writing one gives its bundles and lifts its ceiling, so the admin site keeps it for the superuser.
install
¶
Put installed in force - called by the layer above when its app starts.
ClearanceBackend
¶
Bases: ModelBackend
Django's ModelBackend, less what was taken away from the person, with
the bundles they start with, and within their ceiling. Named in
AUTHENTICATION_BACKENDS in place of ModelBackend, never beside it.
with_perm
¶
with_perm(perm: Any, is_active: bool | None = True, include_superusers: bool = True, obj: Any = None) -> QuerySet[Any]
Everybody holding perm, as has_perm would answer for each: not
whoever it was taken from, whoever starts with it by their role too,
and nobody whose ceiling stops it.
User
¶
Bases: Protocol
What the library asks of a person: Django's user, or anything answering
the same three questions - AnonymousUser among them.
user_of
¶
The person a request carries - Django's or DRF's - as the library sees them.
Django types request.user as its own base classes, which promise less
than every real user has; this is the one place that says so.