hi,
In automation, I can’t call miq_groups of a user caused by druby, eg:
$evm.root[‘user’].miq_groups
So is there any other way I can get the groups if a user belongs to multi groups? Thank you!
hi,
In automation, I can’t call miq_groups of a user caused by druby, eg:
$evm.root[‘user’].miq_groups
So is there any other way I can get the groups if a user belongs to multi groups? Thank you!
Hi @wangxiangyu
AFAIK, the only way a user can belong to multiple groups in MIQ is if they’re authenticating using LDAP/ external auth. One solution could be to use the net-ldap gem to query the LDAP server directly.
@jockey10
Thank you for your reply. I change the automation code:
--- a/lib/miq_automation_engine/service_models/miq_ae_service_user.rb
+++ b/lib/miq_automation_engine/service_models/miq_ae_service_user.rb
@@ -3,7 +3,9 @@ module MiqAeMethodService
expose :current_group, :association => true
expose :current_tenant, :association => true
expose :vms, :association => true
+ expose :miq_groups, :association => true
expose :miq_requests, :association => true
expose :name
expose :email
expose :userid
I can call the miq_groups of a user object in automation now.
Awesome @wangxiangyu! If you like, you can submit a pull request so that your thrifty fix ends up in a ManageIQ release.