Generic objects (DRO) link not clickable

ui

#1

I’m testing generic objects in Garpi4. I created a model and a few instances, linked to services.

Within Service Explorer, as admin I’m able to click on the Instances row referring to /service/show/2?display=generic_objects

show%20go%20link

As a regular user this row is not linked. I switched off all RBAC (tagging filters, access restrictions to owned objects) but still no joy.

What product feature is required to enable this link? Manually modifying the URL the objects are visible for the regular user, custom buttons do appear and function.


#2

Hi,
I was able to reproduce the problem (CFME Version: 5.9.3.4.20180702181921_afd03d7).
Are your Roles imported from a previous version?

The ability to click on the link (and the use Automation --> Automate --> Generic Objects menu) seems to be handled by the features

ident=generic_object_definition name=Generic Object Classes desc=Everything under Generic Object Classes
ident=generic_object            name=Generic Objects        desc=Everything under Generic Objects

however these features are apparently not exposed on the UI and granted to all newly created roles, but in case of imported roles this does not happen and users have no access to generic objects.

There are more granular features defined (but I have no idea if they already work)

vmdb_production=# SELECT identifier, name, description FROM miq_product_features WHERE identifier LIKE 'generic%';

                 identifier                 |            name            |                       description
--------------------------------------------+----------------------------+---------------------------------------------------------
 generic_object_definition                  | Generic Object Classes     | Everything under Generic Object Classes
 generic_object_definition_view             | View                       | View Generic Object Classes
 generic_object_definition_show_list        | List                       | Display Lists of Generic Object Classes
 generic_object_definition_show             | Show                       | Display Individual Generic Object Classes
 generic_object_definition_admin            | Modify                     | Modify Generic Object Classes
 generic_object_definition_delete           | Remove                     | Remove Generic Object Classes
 generic_object_definition_edit             | Edit                       | Edit a Generic Object Class
 generic_object_definition_new              | Add                        | Add a Generic Object Class
 generic_object_definition_ab_group_new     | Add Custom Button Group    | Add a Custom Button Group for a Generic Object Class
 generic_object_definition_ab_group_edit    | Edit Custom Button Group   | Edit a Custom Button Group for a Generic Object Class
 generic_object_definition_ab_group_delete  | Delete Custom Button Group | Delete a Custom Button Group for a Generic Object Class
 generic_object_definition_ab_button_new    | Add Custom Button          | Add a Custom Button for a Generic Object Class
 generic_object_definition_ab_button_edit   | Edit Custom Button         | Edit a Custom Button for a Generic Object Class
 generic_object_definition_ab_button_delete | Delete Custom Button       | Delete a Custom Button for a Generic Object Class
 generic_object                             | Generic Objects            | Everything under Generic Objects
 generic_object_view                        | View                       | View Generic Objects
 generic_object_show_list                   | List                       | Display Lists of Generic Objects
 generic_object_show                        | Show                       | Display Individual Generic Objects
 generic_object_control                     | Operate                    | Perform Operations on Generic Objects
 generic_object_tag                         | Edit Tags                  | Edit Tags of Generic Objects
 generic_object_protect                     | Manage Policies            | Manage Policies of Generic Objects
 generic_object_admin                       | Modify                     | Modify Generic Objects
 generic_object_delete                      | Remove                     | Remove Generic Objects
 generic_object_edit                        | Edit                       | Edit Generic Object
 generic_object_new                         | Add                        | Add a Generic Object

#3
FEATURE_EVERYTHING                = MiqProductFeature.where(identifier: 'everything').first().id
FEATURE_GENERIC_OBJECT            = MiqProductFeature.where(identifier: 'generic_object').first().id
FEATURE_GENERIC_OBJECT_DEFINITION = MiqProductFeature.where(identifier: 'generic_object_definition').first().id

roles_to_update = MiqUserRole.all.reject do |r| 
  skip = false
  skip |= r.miq_product_feature_ids.include?(FEATURE_EVERYTHING) 
  skip |= r.miq_product_feature_ids.include?(FEATURE_GENERIC_OBJECT) 
  skip |= r.miq_product_feature_ids.include?(FEATURE_GENERIC_OBJECT_DEFINITION)  
end

roles_to_update.each do |role|
  current_ids = role.miq_product_feature_ids
  role.miq_product_feature_ids = [FEATURE_GENERIC_OBJECT, FEATURE_GENERIC_OBJECT_DEFINITION ] + current_ids
  role.save!()
end

Since I had to fix that anyway for our environment, I can post the solution for everyone to see
This scripts adds the product_features to all Roles that do not already have it. I think this should also work, when exporting the roles and importing them somewhere else, but I have not tested that yet


#4

Thanks @buc for the detailed answers.

I used a fresh gapri4 instance but copied the EvmRole-user role as a start. This missed the generic_object feature indeed. I modified only the copied role based on your code:

go_id = MiqProductFeature.where(identifier: 'generic_object').first.id
user2role = MiqUserRole.where(name: 'EvmRole-user2').reject.first
user2role.miq_product_feature_ids= user2role.miq_product_feature_ids + [go_id]
user2role.save!

This did cure the GUI, big thanks! Now I’m thinking on running your code above :slight_smile: