diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 18:09:00 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 18:09:00 +0000 |
commit | 411cc77938f99b495e0fe802705d275a28e939ef (patch) | |
tree | 97770ec9904daeaaa1f7546b191d23b0a642da47 /lib/api/broadcast_messages.rb | |
parent | 3e36f70be4bd74a412b2ea1286090b54803a8c20 (diff) | |
download | gitlab-ce-411cc77938f99b495e0fe802705d275a28e939ef.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/broadcast_messages.rb')
-rw-r--r-- | lib/api/broadcast_messages.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/api/broadcast_messages.rb b/lib/api/broadcast_messages.rb index 994e12445b7..48d4f1a0a63 100644 --- a/lib/api/broadcast_messages.rb +++ b/lib/api/broadcast_messages.rb @@ -4,9 +4,6 @@ module API class BroadcastMessages < Grape::API include PaginationParams - before { authenticate! } - before { authenticated_as_admin! } - resource :broadcast_messages do helpers do def find_message @@ -40,6 +37,8 @@ module API optional :target_path, type: String, desc: 'Target path' end post do + authenticated_as_admin! + message = BroadcastMessage.create(declared_params(include_missing: false)) if message.persisted? @@ -76,6 +75,8 @@ module API optional :target_path, type: String, desc: 'Target path' end put ':id' do + authenticated_as_admin! + message = find_message if message.update(declared_params(include_missing: false)) @@ -93,6 +94,8 @@ module API requires :id, type: Integer, desc: 'Broadcast message ID' end delete ':id' do + authenticated_as_admin! + message = find_message destroy_conditionally!(message) |