-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic product features according to tenants #18102
Conversation
dbf07ff
to
ddc18a9
Compare
app/models/miq_product_feature.rb
Outdated
@@ -9,6 +9,7 @@ class MiqProductFeature < ApplicationRecord | |||
has_and_belongs_to_many :miq_user_roles, :join_table => :miq_roles_features | |||
has_many :miq_product_features_shares | |||
has_many :shares, :through => :miq_product_features_shares | |||
belongs_to :tenant, :dependent => :destroy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this delete the tenant if a product feature is deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it needs to be removed, thanks 👍
705b1a6
to
b6565ed
Compare
@gtanzillo |
app/models/tenant.rb
Outdated
after_create :create_tenant_group | ||
before_destroy :ensure_can_be_destroyed | ||
after_create :create_tenant_group, :create_miq_product_features_for_tenant_nodes | ||
before_destroy :ensure_can_be_destroyed, :destroy_tenant_feature_for_tenant_node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that you need to call destroy_tenant_feature_for_tenant_node
. The has_many :miq_product_features, :dependent => :destroy
in this class should take care of deleting the product features associated with the tenant being deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, thanks 👍
app/models/tenant.rb
Outdated
result | ||
end | ||
|
||
def create_miq_product_feature(miq_product_feature) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be named build_...
instead of create_...
since it doesn't actually create the miq_product_feature
db/fixtures/miq_product_features.yml
Outdated
:children: | ||
- :name: Add | ||
:description: Add Dialog in the Dialog Editor | ||
:feature_type: admin | ||
:hidden: true | ||
:feature_type: tenant_node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it would be better to just add a new column for this instead of overloading feature_type
. Maybe a boolean column called per_tenant
? I'll leave it up to you for the implementation.
b6565ed
to
ea8bbd5
Compare
21b7aac
to
36b8c28
Compare
36b8c28
to
cd56be0
Compare
Checked commits lpichler/manageiq@3bed523~...cd56be0 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@miq-bot add_label hammer/yes |
Dynamic product features according to tenants
@lpichler @gtanzillo This PR is marked as |
@simaishi I am sorry it was added too early, so for now hammer/no and we are waiting for answer |
@miq-bot remove_label hammer/yes will need to wait for decision ^ |
@miq-bot add_label blocker |
… role - This was a bug in the logic in ManageIQ#18102 - This fixes test failures in the API repo
… role - This was a bug in the logic in ManageIQ#18102 - This fixes test failures in the API repo
@miq-bot add_label hammer/yes |
Dynamic product features according to tenants (cherry picked from commit e391dec) https://bugzilla.redhat.com/show_bug.cgi?id=1468795
Hammer backport details:
|
depends on:
add tenant_nodes to Add, Edit, Copy and Delete permission for service dialogs:
part of #18100
Links
@miq-bot assign @gtanzillo