created a common permissions checking function.
prevent someone from creating an environment in a deployment that they don't own