Move role related views to FAB Auth manager:

- List roles
- Edit role
- Create role
- View role
"""
        Method for authenticating user with OAuth.
        :userinfo: dict with user information
                   (keys are the same as User model columns)
        """
        
        if "username" in userinfo:
            username = userinfo["username"]
        elif "email" in userinfo:
            username = userinfo["email"]
        else:
            log.error("OAUTH userinfo does not have username or email %s", userinfo)
            return None
        
        if (username is None) or username == "":
            return None
        
        user = self.find_user(username=username)
        
        if user and (not user.is_active):
            return None
        
        if (not user) and (not self.auth_user_registration):
            return None
        
        if user and self.auth_roles_sync_at_login:
            user.roles = self._oauth_calculate_user_roles(userinfo)