added logic to the gallery home template to check if the user is authorized to view the gallery