WordPress enables you to remove any capabilities pre assigned to any user role.
In this 1st example, the code removes specific capabilities for the editors role preventing all editors from deleting any posts and pages.
If you want to use this code for another role, simply change all instances of editor in the code to the name of any other role.
The 2nd example below prevents users assigned the author role from deleting any posts
Another way to control what your users can and cannot access is to remove specific admin menu links for a specific user.