Skip to content

Commit

Permalink
Update permissions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer committed Apr 28, 2023
1 parent 3091641 commit 1846288
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,17 @@ async def create_app() -> web.Application:
users = {
"simple": (p(Simple),),
"mixed": (p(Simple, "view"), p(Simple, "edit"), p(SimpleParent, "view")),
"negated": (Permissions.all, p(SimpleParent, negated=True), p(Simple, "edit", negated=True)),
"negated": (Permissions.all, p(SimpleParent, negated=True),
p(Simple, "edit", negated=True)),
"field": (Permissions.all, p(Simple.optional_num, negated=True)),
"field_edit": (Permissions.all, p(Simple.optional_num, "edit", negated=True)),
"filter": (Permissions.all, p(Simple, filters={Simple.num: 5})),
"filter_edit": (Permissions.all, p(Simple, "edit", filters={Simple.num: 5})),
"filter_add": (Permissions.all, p(Simple, "add", filters={Simple.num: 5})),
"filter_delete": (Permissions.all, p(Simple, "delete", filters={Simple.num: 5})),
"filter_field": (Permissions.all, p(Simple.optional_num, filters={Simple.num: 5})),
"filter_field_edit": (Permissions.all, p(Simple.optional_num, "edit", filters={Simple.num: 5}))
"filter_field_edit": (Permissions.all, p(Simple.optional_num, "edit",
filters={Simple.num: 5}))
}
for name, permissions in users.items():
if any(admin["permission_re"].fullmatch(p) is None for p in permissions):
Expand Down

0 comments on commit 1846288

Please sign in to comment.