These are chat archives for ManageIQ/manageiq/performance

21st
Sep 2017
Pradeep Kumar Surisetty
@psuriset
Sep 21 2017 13:58
moving discussion here. @psav @kbrock
@kbrock Can you please share screenshot here
Pradeep Kumar Surisetty
@psuriset
Sep 21 2017 14:03
yeh np. got it. getting used to gitter.
u = User.find_by(name: "Administrator")
u.current_group.name # name of the current / active group
# => "EvmGroup-super_administrator" 
u.miq_groups.map(&:name)
# => ["EvmGroup-super_administrator"]
u.miq_groups << MiqGroup.find_by(description: "EvmGroup-container_operator")
u.reload # make sure we are reading the values from the database
u.miq_groups.map(&:name)
# => ["EvmGroup-super_administrator", "EvmGroup-container_operator"]
thanks @kbrock
Keenan Brock
@kbrock
Sep 21 2017 14:06
^ that adds an additional group to someone
This could be done in the regular ui, but it is tricky UX, so we've opted to not do it.
Pete Savage
@psav
Sep 21 2017 14:29
@kbrock I missed it initially as I just saw the "current" group in the users table
then I foudn the linker
after seeing your snippet
:)
Keenan Brock
@kbrock
Sep 21 2017 14:30
+1
@psav I would love to remove current_group part. Since every http request should convey the current group, it shouldn't be stored in the db... but legacy sguff
Pete Savage
@psav
Sep 21 2017 14:32
yeh yeh
Initially I was like...can't be done ;)
but @psuriset I think hte ruby way is far better than direct db interaction