removed insecure and add conditions to allow users to submit resources