Implement ACLs
This commit is contained in:
+6
-3
@@ -1,12 +1,11 @@
|
||||
from dataclasses import dataclass, field
|
||||
from functools import cached_property
|
||||
|
||||
from flask import g
|
||||
from grung.types import BackReference, Collection, Pointer, Record
|
||||
|
||||
from ttfrog import schema
|
||||
|
||||
from flask import g
|
||||
|
||||
READ_ONLY_FIELD_TYPES = [Collection, Pointer, BackReference]
|
||||
|
||||
|
||||
@@ -15,6 +14,7 @@ class Form:
|
||||
"""
|
||||
The base Form controller for the web UI.
|
||||
"""
|
||||
|
||||
record: Record
|
||||
data: field(default_factory=dict)
|
||||
|
||||
@@ -26,7 +26,6 @@ class Form:
|
||||
|
||||
def prepare(self):
|
||||
for key, value in self.data.items():
|
||||
|
||||
# filter out fields that cannot be set by the user
|
||||
if key in self.read_only:
|
||||
continue
|
||||
@@ -41,6 +40,7 @@ class Page(Form):
|
||||
"""
|
||||
A form for creating and updating Page records.
|
||||
"""
|
||||
|
||||
record: schema.Page
|
||||
|
||||
@cached_property
|
||||
@@ -53,6 +53,7 @@ class NPC(Page):
|
||||
"""
|
||||
A form for creating and updating Page records.
|
||||
"""
|
||||
|
||||
record: schema.NPC
|
||||
|
||||
|
||||
@@ -61,6 +62,7 @@ class User(Page):
|
||||
"""
|
||||
A form for creating and updating Page records.
|
||||
"""
|
||||
|
||||
record: schema.NPC
|
||||
|
||||
|
||||
@@ -69,4 +71,5 @@ class Group(Page):
|
||||
"""
|
||||
A form for creating and updating Page records.
|
||||
"""
|
||||
|
||||
record: schema.NPC
|
||||
|
||||
Reference in New Issue
Block a user