Don't like this style? Click here to change it! blue.css

LOGIN:
Welcome .... Click here to logout

Class 14: Role-Based Access Control (RBAC)

We're going to head to the mountain tops then back to the trenches to look at "RBAC"; a powerful (but very abstract) security framework used by the vast majority of large institutions. We'll start with a look at it from the standards level perspective.

There are several flavors of RBAC specified in the official standard.

Let's start with the core RBAC the minimum set of features to have a role-based access system.

Core RBAC

So the goal of this is to control which users of the system can execute actions on objects in a way that can quickly adjusted in large organizations. There are six fundamental elements in this security model:

Does this work?

Specifications: In the forum example we started to build last time what are some OBS, OPS, and Roles you could imagine?

Relational Algebra

So this abstract model that works for so many businesses and organizations boils down to some set-theory based rules. If your discrete math is a little weak here are the things you need:

Relation Play: Let \(A = \{1, 3, 5, 7\}\) and \(B = \{2, 6\}\). Write down all tuples defined by the relation \(\mathcal{R} = \{(a,b) \mid a \leq b, a \in A, b \in B\} \subset A \times B\)

Formal Core RBAC:

Here are the relational algebra rules that define RBAC:

Write down some of these: for your created roles and operations and objects add some users and assign them roles by defining what UA, assigned_users, PRMS, PA, assigned_permissions look like for your forum app.

Functional Version

Here are the functions this leads to:

Now Design With It

Let's build an artist auction site. Artists create "paintings" and bidders look at the "paintings" then make "bids" on those paintings.

I want an sqlite database that has three roles:

I want three objects:

The role permissions are as follows:

Let's start with three users:

Assumptions

So you have all built logins already. So for this experiment we will let the user tell us their name without verification as part of the payload. (Pretend like the login handles auth perfectly well.) Your job is the following:

  1. Design, create, and populate the RBAC-based tables in SQLite3
  2. Write one PHP utility function which consumes:
    • a username
    • an operation (Create, Read, Update, Destroy)
    • an object/resource (User, Painting, Bid)
    It should return true or false based on the data in your database.

Your design should be flexible enough that you can revoke the ability to update bids from bidders with one row removal.

Now create a person "Claude" which is both an artist and a bidder. This person should work without issue.