def get_logged_in_username(): """A Method to get the current logged in user's username Returns: str """ user = get_logged_in_user() if not user: logger = LMLogger() logger.logger.error( "Failed to load a user identity from request context.") raise ValueError( "Failed to load a user identity from request context.") return user.username
def get_logged_in_author(): """A Method to get the current logged in user's GitAuthor instance Returns: GitAuthor """ user = get_logged_in_user() if not user: logger = LMLogger() logger.logger.error( "Failed to load a user identity from request context.") raise ValueError( "Failed to load a user identity from request context.") # Create a GitAuthor instance if possible return GitAuthor(name=user.username, email=user.email)