File tree 2 files changed +18
-2
lines changed
app/controllers/project_phases
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 30
30
31
31
module ProjectPhases
32
32
class HoverCardController < ApplicationController
33
- no_authorization_required! :show
33
+ before_action :authorize
34
+ before_action :check_feature_flag
34
35
before_action :assign_gate
35
36
before_action :find_phase
37
+ before_action :check_access
36
38
37
39
layout false
38
40
39
41
def show ; end
40
42
41
43
private
42
44
45
+ def check_feature_flag
46
+ return if OpenProject ::FeatureDecisions . stages_and_gates_active?
47
+
48
+ render json : { error : "Not found" } , status : :not_found
49
+ end
50
+
51
+ def check_access
52
+ return if User . current . allowed_in_project? ( :view_project_phases , @phase . project )
53
+
54
+ render json : { error : "Forbidden" } , status : :forbidden
55
+ end
56
+
43
57
def assign_gate
44
58
@gate = params [ :gate ]
45
59
return if @gate . in? ( %w[ start finish ] )
Original file line number Diff line number Diff line change 135
135
require : :member
136
136
137
137
map . permission :view_project_phases ,
138
- { } ,
138
+ {
139
+ "project_phases/hover_card" : :show
140
+ } ,
139
141
permissible_on : :project ,
140
142
dependencies : :view_project ,
141
143
visible : -> { OpenProject ::FeatureDecisions . stages_and_gates_active? }
You can’t perform that action at this time.
0 commit comments