Permited peer assistance in PhD and MSc thesis
In my opinion, none of your numbered items (1-4) is acceptable. As for the two bullet points above, they must be carefully circumscribed:


You can of course get comments on your manuscript from your peers. This should not include solving your problems for you or writing parts of the work.
Some technical work may be performed by someone else: chemical synthesis of a compound you are using, specialized analysis of some samples etc. Each instance should be clearly specified: in the text, in the legend of the figures obtained this way etc. The reader needs to see clearly the distinction between your effort and that of other parties.


All this is codified in the saying: "Credit where credit is due". However, this principle is applied slightly differently to a thesis and to a journal paper:


A thesis demonstrates the ability of its author, who is assumed to have done all the work contained in it. That is why any external contribution should be indicated.
A paper's main goal is to present a scientific result. It is therefore less crucial to know "who did what", although some journals (e.g. PNAS, PLOS One) do require it.