how to dynamically remove all edit and delete functionality of a page

after about 8 hours.. I realized a plugin call advanced access manager, which is free, has 2 toggle checkboxes on each page for this exactly lol.

why reinvent the wheel I Guess