This tool generates typical CRUD RESTful API for a database table; to be added to Node++ project. Requires also adding compatible DAO/ORM class to the project.
Authorization
You can define up to 4 levels of authorization. Middle levels can have further restrictions if column is defined: only the records belonging to the current user will be accessible. For example, the table may have columns sales_rep
and cust_id
. These columns can be specified for the Middle and Low levels, respectively. Then the sales rep will be able to access only the records belonging to their customers, that is records with sales_rep=<user ID>
, and the customer will only be able to access theirs.
In order for authorization to work properly, the table has to have single column as a primary key – either integer or string – and it needs to be the first column in the table definition.
Changing authorization rules after the files have been generated
Session levels and access permissions can easily be changed at any time by defining macros outside the generated files (see generated *.h
file). On the other hand, binding columns affect generated logic so in the case change is required, re-generating will be better than manually changing previously generated code.
Filtering
As apparently there's no standard for filtering URLs, I decided to optimize it for clarity and shortness. I tried to avoid special characters that would force ugly URL encoding. Here's the summary:
Order can be specified by o
parameter, i.e.:
Descending order is indicated by od
parameter, i.e.: