moved the repetive permissions checking for surveys into a function
added more tests for adding surveys including using master questions

I have also fixed some bugs found in the copying surveys feature.
Previously users can edit or delete questions from survey templates
that they do not own or have already been used by making a copy
of the survey. The reason this happened was because when the survey
was copied, the questions were not copied. Instead the new survey
references the existing questions.

I have also modified loading master questions to not load the master
attribute, because we will start having dupliated master questions.
The master field is now defaulted to no even when we are loading a
master question (which obviously has yes for its master attribute).