Skip to content
Snippets Groups Projects
Commit 35a20fb5 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Fixed publisher routes authentication

parent fa9c7720
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ module PublisherController ...@@ -2,7 +2,7 @@ module PublisherController
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
before_action :authenticate_user!, only: [:show_all_drafts, :show_liked_learning_objects, :show_liked_collections] before_action :authenticate, only: [:show_all_drafts, :show_liked_learning_objects, :show_liked_collections]
before_action :set_publisher, only: [:show_all_drafts, :show_all_learning_objects, :show_all_collections, :show_liked_learning_objects, :show_liked_collections] before_action :set_publisher, only: [:show_all_drafts, :show_all_learning_objects, :show_all_collections, :show_liked_learning_objects, :show_liked_collections]
before_action -> { authorize @publisher }, only: [:show_all_drafts, :show_liked_learning_objects, :show_liked_collections] before_action -> { authorize @publisher }, only: [:show_all_drafts, :show_liked_learning_objects, :show_liked_collections]
end end
...@@ -35,6 +35,10 @@ module PublisherController ...@@ -35,6 +35,10 @@ module PublisherController
protected protected
def authenticate
authenticate_user!
end
def set_publisher def set_publisher
user, id = request.path.split('/')[2, 3] user, id = request.path.split('/')[2, 3]
return nil unless %w(users institutions).include? user return nil unless %w(users institutions).include? user
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment