Posts persmission system

I’m makin a social website with a frontpage that looks like a blog. However, I need to restrict which posts the users have access to. I want some of my posts to only be visible by people born in a spesific year and so on. How should I make such a system?

What I have done is to make two permissions-tables. One that stores user permissions and another one that stores post permissions. If there aren’t any permissions for a post, the post is visible to any user. If not, the user have to share some of the “permission id’s” with the post.

The problem is that I feel like this already should have been invented by someone, and I can’t get my head around and figure out how to make a single DBCriteria for it. And then I can’t use neat tools like CPagination. I have looked into the RBAC system, but it doesn’t seem like it works if I don’t know the post-permissions in advance. Am I wrong?