URL Restrictions? Need only people who are logged in AND have a specific role (or roles) to access all pages for a site

I have a site that needs to only allow people who are logged in and have at least one of 3 possible roles to have access to the pages of the site. I'm not new to programming, but am new to both php and web development. I would prefer an in-house solution instead of a plugin, but at this point I will take what I can get.

So how it would ideally work was that a user from our main site could come to the secondary site (which are linked om terms of user accounts) and they would hit the login page. They should not have access to any of the other pages until they login. After they login if they have a specific role (Instructor, Admin, or Super Admin) they can access the rest of the site. If they don't have one of those roles they should always be redirected to a page that tells them they don't have access to this site (ie /no-access).

Is there a way or a plugin to let me do this? Thanks

Edit: Since this might need more narrow of a scope...

How do I restrict access to the webpages based on a users role? I know there's a way to do it with

is_user_logged_in()  current_user_can(Capabilities)

and custom roles with specific capabilities, is there a way to say

user_has_role(Role)

Topic content-restriction accessibility user-roles login Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.