File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
controllers/ops_controller Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ def role_allows?(**options)
17
17
end
18
18
19
19
options [ :feature ] = MiqProductFeature . tenant_identifier ( options [ :feature ] , id )
20
+ # dynamic tenant feature identifiers need to bypass feature validation
21
+ options [ :skip_feature_validation ] = true
20
22
end
21
23
22
24
super ( **options )
Original file line number Diff line number Diff line change @@ -104,6 +104,16 @@ def role_allows?(**options)
104
104
return false
105
105
end
106
106
107
+ # ops_rbac role_allows's dynamic tenant features are supported in rbac but not
108
+ # with direct lookup in validate_features so we skip it.
109
+ validate_features ( features ) unless !!options . delete ( :skip_feature_validation )
110
+
111
+ Rbac . role_allows? ( :user => User . current_user , **options ) rescue false
112
+ end
113
+ module_function :role_allows?
114
+ public :role_allows?
115
+
116
+ def validate_features ( features )
107
117
# Detect if queried features are missing from the database and possibly invalid
108
118
if !Rails . env . production? && features . detect { |feature | !MiqProductFeature . feature_exists? ( feature ) }
109
119
message = "#{ __method__ } no feature was found with identifier: #{ features . inspect } . Correct the identifier or add it to miq_product_features.yml."
@@ -114,12 +124,8 @@ def role_allows?(**options)
114
124
raise ( "#{ message } Note: detected features: #{ identifiers . inspect } " )
115
125
end
116
126
end
117
-
118
- Rbac . role_allows? ( :user => User . current_user , **options ) rescue false
119
127
end
120
-
121
- module_function :role_allows?
122
- public :role_allows?
128
+ module_function :validate_features
123
129
124
130
# NB: This differs from controller_for_model; until they're unified,
125
131
# make sure you have the right one.
You can’t perform that action at this time.
0 commit comments