Be in someone’s good/bad books
To be in or out of favour with someone, dates from the early 19th century and means the same thing as to be in someone’s good or bad graces, which dates back to the 1400s.