Add base controller for service controllers
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
This commit is contained in:
parent
852e2fea1e
commit
f49aff262c
9
app/controllers/services/base_controller.rb
Normal file
9
app/controllers/services/base_controller.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
class Services::BaseController < ApplicationController
|
||||||
|
before_action :set_current_section
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_current_section
|
||||||
|
@current_section = :services
|
||||||
|
end
|
||||||
|
end
|
@ -1,8 +1,7 @@
|
|||||||
class Services::RemotestorageController < ApplicationController
|
class Services::RemotestorageController < Services::BaseController
|
||||||
before_action :require_user_signed_in
|
before_action :authenticate_user!
|
||||||
before_action :require_service_enabled
|
|
||||||
before_action :require_feature_enabled
|
before_action :require_feature_enabled
|
||||||
before_action :set_current_section
|
before_action :require_service_available
|
||||||
|
|
||||||
def dashboard
|
def dashboard
|
||||||
# unless current_user.services_enabled.include?(:remotestorage)
|
# unless current_user.services_enabled.include?(:remotestorage)
|
||||||
@ -18,13 +17,7 @@ class Services::RemotestorageController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def require_service_enabled
|
def require_service_available
|
||||||
unless Setting.remotestorage_enabled?
|
http_status :not_found unless Setting.remotestorage_enabled?
|
||||||
http_status :not_found
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_current_section
|
|
||||||
@current_section = :services
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user