Prevent unauthenticated users commenting on notes via the API
This commit is contained in:
parent
5d916975db
commit
efd2b92a80
2 changed files with 4 additions and 4 deletions
|
@ -12,7 +12,7 @@ class ApiAbility
|
|||
|
||||
if Settings.status != "database_offline"
|
||||
can [:show, :download, :query], Changeset
|
||||
can [:index, :create, :comment, :feed, :show, :search], Note
|
||||
can [:index, :create, :feed, :show, :search], Note
|
||||
can :index, Tracepoint
|
||||
can [:index, :show], User
|
||||
can [:index, :show], Node
|
||||
|
@ -31,7 +31,7 @@ class ApiAbility
|
|||
if Settings.status != "database_offline"
|
||||
can [:index, :new, :create, :show, :edit, :update, :destroy], ClientApplication
|
||||
can [:new, :create, :reply, :show, :inbox, :outbox, :mark, :destroy], Message
|
||||
can [:close, :reopen], Note
|
||||
can [:comment, :close, :reopen], Note
|
||||
can [:new, :create], Report
|
||||
can [:create, :show, :update, :destroy, :data], Trace
|
||||
can [:details, :gpx_files], User
|
||||
|
|
|
@ -9,11 +9,11 @@ class GuestApiAbilityTest < ApiAbilityTest
|
|||
test "note permissions for a guest" do
|
||||
ability = ApiAbility.new nil
|
||||
|
||||
[:index, :create, :comment, :feed, :show, :search].each do |action|
|
||||
[:index, :create, :feed, :show, :search].each do |action|
|
||||
assert ability.can?(action, Note), "should be able to #{action} Notes"
|
||||
end
|
||||
|
||||
[:close, :reopen, :destroy].each do |action|
|
||||
[:comment, :close, :reopen, :destroy].each do |action|
|
||||
assert ability.cannot?(action, Note), "should not be able to #{action} Notes"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue