This will authenticate the admin, if not logged in, it will redirect to the login page-
_auth();
Check user has access to specific module-
if(!has_access($user->roleid,'customers','edit')){ // User does not have permission to edit customers }