redmine_airbrake_backend 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/controllers/airbrake_controller.rb +22 -15
- data/lib/redmine_airbrake_backend/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd9ed3cb0664c977824beee01de24dabd2883bba7bbaa0df8dbe1bfdbfd6ca47
|
4
|
+
data.tar.gz: 4d52088e65e445ab788d459ef88d88395716fd544e85ea97a15082198f586c11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a17ebe81cdb4aac103031e7ee8920f33a0a23ed9075a1deb0f48b288ebb0c3fd24b91580b83c62c36d805c096a240d467ac6d488b6a75e38ebc4e9db7bdf398
|
7
|
+
data.tar.gz: dec97c57aab26ddd559c0680eae89ed05b810866755866b0ae8e326a6438a314423c5d31adb32e96f91d4ecd116b20473cfcd5450184819a3eac061c8b1604b0
|
data/CHANGELOG.md
CHANGED
@@ -3,9 +3,8 @@ require 'redmine_airbrake_backend/notice'
|
|
3
3
|
|
4
4
|
# Controller with airbrake related stuff
|
5
5
|
class AirbrakeController < ::ApplicationController
|
6
|
-
class InvalidRequest < StandardError; end
|
7
|
-
|
8
6
|
skip_before_action :verify_authenticity_token
|
7
|
+
skip_before_action :session_expiration, :user_setup, :check_if_login_required, :set_localization, :check_password_change
|
9
8
|
|
10
9
|
prepend_before_action :find_project
|
11
10
|
prepend_before_action :parse_key
|
@@ -19,8 +18,6 @@ class AirbrakeController < ::ApplicationController
|
|
19
18
|
|
20
19
|
after_action :cleanup_tempfiles
|
21
20
|
|
22
|
-
rescue_from InvalidRequest, with: :render_bad_request
|
23
|
-
|
24
21
|
private
|
25
22
|
|
26
23
|
def find_project
|
@@ -38,16 +35,30 @@ class AirbrakeController < ::ApplicationController
|
|
38
35
|
@key = JSON.parse(params[:key]).with_indifferent_access rescue nil
|
39
36
|
end
|
40
37
|
|
41
|
-
|
42
|
-
|
38
|
+
render_error('No or invalid API key format', :unauthorized) if @key.blank? || @key[:key].blank?
|
39
|
+
end
|
40
|
+
|
41
|
+
def authorize
|
42
|
+
User.current = User.find_by_api_key(@key[:key])
|
43
|
+
|
44
|
+
if User.current.blank? || User.current.anonymous?
|
45
|
+
render_error('Failed to authenticate', :unauthorized)
|
46
|
+
|
47
|
+
return
|
48
|
+
end
|
49
|
+
|
50
|
+
return if User.current.allowed_to?({ controller: params[:controller], action: params[:action] }, @project)
|
51
|
+
|
52
|
+
render_error('Access Denied', :forbidden)
|
43
53
|
end
|
44
54
|
|
45
55
|
def find_tracker
|
46
56
|
@tracker = record_for(@project.trackers, :tracker)
|
47
|
-
|
57
|
+
|
58
|
+
render_error('No or invalid tracker', :failed_dependency) if @tracker.blank?
|
48
59
|
|
49
60
|
# Check notice ID field
|
50
|
-
|
61
|
+
render_error('Custom field for notice hash not available on selected tracker', :failed_dependency) if @tracker.custom_fields.find_by(id: notice_hash_field.id).blank?
|
51
62
|
end
|
52
63
|
|
53
64
|
def find_category
|
@@ -66,14 +77,10 @@ class AirbrakeController < ::ApplicationController
|
|
66
77
|
@repository = @project.repositories.find_by(identifier: (@key[:repository] || ''))
|
67
78
|
end
|
68
79
|
|
69
|
-
def
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
def render_bad_request(error)
|
74
|
-
::Rails.logger.warn(error.message)
|
80
|
+
def render_error(error, status = :internal_server_error)
|
81
|
+
::Rails.logger.warn(error)
|
75
82
|
|
76
|
-
render
|
83
|
+
render json: { error: { message: error } }, status: status
|
77
84
|
end
|
78
85
|
|
79
86
|
def render_airbrake_response
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine_airbrake_backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Schwab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|