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)
1717 end
1818
1919 options [ :feature ] = MiqProductFeature . tenant_identifier ( options [ :feature ] , id )
20+ # dynamic tenant feature identifiers need to bypass feature validation
21+ options [ :skip_feature_validation ] = true
2022 end
2123
2224 super ( **options )
Original file line number Diff line number Diff line change @@ -104,6 +104,16 @@ def role_allows?(**options)
104104 return false
105105 end
106106
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 )
107117 # Detect if queried features are missing from the database and possibly invalid
108118 if !Rails . env . production? && features . detect { |feature | !MiqProductFeature . feature_exists? ( feature ) }
109119 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)
114124 raise ( "#{ message } Note: detected features: #{ identifiers . inspect } " )
115125 end
116126 end
117-
118- Rbac . role_allows? ( :user => User . current_user , **options ) rescue false
119127 end
120-
121- module_function :role_allows?
122- public :role_allows?
128+ module_function :validate_features
123129
124130 # NB: This differs from controller_for_model; until they're unified,
125131 # make sure you have the right one.
You can’t perform that action at this time.
0 commit comments