Many_Many AR with restrictions

Consider the ER diagram on the attached image (if attached).

which is the first image on http://www.yiiframework.com/doc/guide/1.1/en/database.arr page.

I have a question about Post-Category Many_Many relation.

In order to simulate my case lets assume that not every user

can use each Category. Namely the categories can one user select

are restricted to some subset of all categories. Lets assume in the user

table (or in another table) we put the category ids that user can select.

In this situation , how can I write a many-many relation between Post-Category

which only joins that user’s post categories?