Ubaydullah bin Abi Yazid relates concerning Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both): "When he was asked about any matter, if it was in the Book of Allah he would give his ruling according to it; if it was not in the Book of Allah but (something about it) was established from the Messenger of Allah (peace and blessings be upon him), he would report that; if it was neither in the Book of Allah nor in any judgement of the Messenger of Allah (peace and blessings be upon him), but was reported from Sayyiduna Abu Bakr and Sayyiduna Umar (may Allah be pleased with them both), he would adopt that; and if no ruling was established from them either, he would then exercise ijtihad with his own scholarly insight."
Imam al-Hakim, and through him Imam al-Bayhaqi in his Sunan, also narrated it, and all the narrators of the chain of this report are thiqat (trustworthy).
Hadith Referenceإتحاف الخيرة المهرة بزوائد المسانيد العشرة / كتاب القضاء وما على القاضي في الخصوم والشهود / 4893