User-based permissions?

I am trying to allow customers to be able to view certain DocTypes that pertain to them via portal pages.

It seems that the ERPNext Project DocType has a table field that is designed to handle these permissions without using the User Permissions DocType specifically.

How can I replicate something similar for other DocTypes? Where is the code that handles this found?