Skip to content
Snippets Groups Projects
Commit 9f0b788b authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

change publisher controller to only an curator user can publish

parent a8218e32
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ module SubmissionController ...@@ -25,7 +25,7 @@ module SubmissionController
private private
def submitted def submitted
return @learning_object.state == "submitted" return @learning_object.submitted?
end end
def set_new_submission def set_new_submission
......
...@@ -20,7 +20,7 @@ class V1::LearningObjects::PublishesController < ApplicationController ...@@ -20,7 +20,7 @@ class V1::LearningObjects::PublishesController < ApplicationController
end end
def authorize! def authorize!
authorize(@learning_object || LearningObject.new, :update?) authorize(@learning_object, :publish?)
end end
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
......
...@@ -26,6 +26,10 @@ class LearningObjectPolicy < ApplicationPolicy ...@@ -26,6 +26,10 @@ class LearningObjectPolicy < ApplicationPolicy
record if owns? record if owns?
end end
def publish?
record if user_can_curate? && record.submitted?
end
def destroy? def destroy?
record if owns? record if owns?
end end
......
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