Skip to content
Snippets Groups Projects
Commit 081abf58 authored by Martin Mareš's avatar Martin Mareš
Browse files

Gatekeeper: přidána funkce is_ancestor_of

S právy moc společného nemá, ale gatekeeper se stará o obecné
kešování předků.
parent 677052c8
Branches
No related tags found
1 merge request!95Reforma orgovského rozhraní ke kolům a soutěžím
This commit is part of merge request !95. Comments created here will be created in the context of that merge request.
......@@ -307,6 +307,11 @@ class Gatekeeper:
self.parent_cache[pid] = db.get_place_parents(place)
return self.parent_cache[pid]
def is_ancestor_of(self, ancestor: db.Place, of: db.Place) -> bool:
parents = self.get_parents(of)
parent_ids = set(p.place_id for p in parents)
return ancestor.place_id in parent_ids
def rights_for(
self, place: Optional[db.Place] = None, year: Optional[int] = None,
cat: Optional[str] = None, seq: Optional[int] = None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment