Maybe there’s a way to write your own Server-Module-equivalent of table.client_writeable()
and table.client_readable()
. Failing that, you will have to layer over what Anvil already provides.
Thanks to Oracle and PostgreSQL exposure, I’m somewhat familiar with their role-based access control systems. SQLite delegates permission issues to user code, through a user-definable callback function. So there are a wide variety of systems out there, each working somewhat differently. You likely have a specific set of rules in mind.
A great deal depends upon the patterns of access you intend to support, as well as your actual rules, and how general you want to make it. (The YAGNI Principle comes to mind.) Some specific combinations may be simple to code up.
For a crude example, you could give each record a permissions column, and thus tag each record with the specific permissions needed to access it. Then table.client_*()
-style equality-tests would largely work, once you’d boiled down the permissions actually available to the designated user. Your code could also compute the set of columns to include in the view, based on stored permissions, if necessary.
To some extent, it’s a bookkeeping issue. In simpler cases, roles and rules can be hard-coded in your Server Module. In the most general case, you’ll need to set up tables to record the access details, as needed by your implementation.
If you can’t use the existing table.client_*()
functions to return a view, then perhaps you can return a buffer (list
of dict
s), instead. You’d have your own, custom-written Server Module functions, to return the list, and act upon any modifications sent back to the Server Module.
The simulation wouldn’t be perfect. (Date/time values, in particular, have to be converted to/from text/numbers, for transmittal between Server and Client [and Uplink].) But I suspect that you can probably implement much of the behavior you want.