ArrestDB
ArrestDB copied to clipboard
Add $methods and $tables array and $table_prefix
I would like to add a $tables array with allowed tables and a possible $table_prefix in the code.
Suggested approach:
- add $tables array and $table_prefix variable after the $dsn variable
- add static function Allowed in ArrestDB class which checks if a certain table is available in the $tables array and otherwise exits with a 403 (just like for the $clients array)
- add '$table = $table_prefix.$table; ArrestDB::Allowed($table);' to each ArrestDB::Serve function implementation
Can I add it and is this the right approach?
This is totally possible. I'm not sure why add another layer of complexity atop of ArrestDB tho:
- you could simply create a user that's only allowed to read/write certain tables and use that DSN
- I've never been a big fan of table prefixes, why wouldn't you want to access the table explicitly?