Is there a recommended practice or framework to achieve record-level-permission and attribute level visibility with google-app-engine db.Model (and/or ndb.Model) ?
I have read about model-hooks, but I would love to see if there is an existing recommended best-practice to do this.
class Person(db.Model):
first_name = db.StringProperty()
last_name = db.StringProperty()
city = db.StringProperty()
# Record level permissions:
# "top" visible only to managers
# "medium" visible to managers & supervisors
# "none" visible to all (unless other permissions restrict)
secrecy = db.StringProperty(required=True, choices=set(["top", "medium", "none"]))
birth_year = db.IntegerProperty() # Accessible only with "Manager" permission
height = db.IntegerProperty() # Writable only with "Supervisor" permission
Some more context to this - I need these permission checks to be model level since I want to allow users to execute arbitary GQL queries and DMLs via a simple JavaScript RPC call.