ArrestDB icon indicating copy to clipboard operation
ArrestDB copied to clipboard

Add $methods and $tables array and $table_prefix

Open lievenjanssen opened this issue 10 years ago • 1 comments

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?

lievenjanssen avatar Jun 04 '14 15:06 lievenjanssen

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?

alixaxel avatar Jun 14 '14 13:06 alixaxel