This is my second article on how to build a role-based access
control system in SQL. In the first article I gave a high-level
overview of access control systems in general, especially in the
web-application context, and talked about how some are
implemented. I introduced the problems I designed my system to
solve, and gave a roadmap for where this series of articles will
end. I finished that article with a sketch of some basics to
provide row-level read, write, and delete access control.
This article picks up where I left off. I want to revisit some
things I swept under the rug in the first article, because I
didn't want to throw all the complexity in at once. I'll explain
my current system's full functionality, which includes roles,
type checking, table-level and set-level privileges, and more. I
will show you the design in great detail, and give working
examples and ready-to-run SQL queries. I'll also explore ideas
for extending or …
[Read more]