From 1131c656d58cf881fd5e6f735de86ce53578b2f8 Mon Sep 17 00:00:00 2001 From: Espen Antonsen Date: Mon, 3 Aug 2009 16:39:33 +0200 Subject: [PATCH] block public access setting --- app/controllers/albums_controller.rb | 2 +- app/controllers/application_controller.rb | 5 ++++- app/controllers/collections_controller.rb | 2 +- app/controllers/photos_controller.rb | 2 +- app/controllers/tags_controller.rb | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index bdb97b7..cf2abf5 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -1,5 +1,5 @@ class AlbumsController < ApplicationController - + before_filter :check_public_access before_filter :require_role_admin, :only => [:untouched, :new, :create, :edit, :update, :destroy] def index diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a7b81ae..6ea93a2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -8,9 +8,12 @@ class ApplicationController < ActionController::Base filter_parameter_logging :password, :password_confirmation helper_method :current_user, :current_user_session - private + + def check_public_access + require_user unless APP_CONFIG[:public] + end def current_user_session return @current_user_session if defined?(@current_user_session) diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb index e7f3349..3525d31 100644 --- a/app/controllers/collections_controller.rb +++ b/app/controllers/collections_controller.rb @@ -1,5 +1,5 @@ class CollectionsController < ApplicationController - + before_filter :check_public_access before_filter :require_role_admin, :only => [:new, :create, :edit, :update, :destroy] def index diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 4cfc78d..f826bc1 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -1,5 +1,5 @@ class PhotosController < ApplicationController - + before_filter :check_public_access before_filter :require_role_admin, :only => [:untouched, :upload, :new, :create, :edit, :update, :destroy] def index diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index d299358..6d8c194 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -1,4 +1,5 @@ class TagsController < ApplicationController + before_filter :check_public_access def index if params[:album_id]