app/controllers/ops_controller/ops_rbac.rb
# Get variables from group edit form
Get variables from group edit form
Get variables from group edit form
def rbac_group_get_form_vars
    if %w(up down).include?(params[:button])
      move_cols_up   if params[:button] == "up"
      move_cols_down if params[:button] == "down"
    else
      @edit[:new][:description]  = params[:ldap_groups_user]  if params[:ldap_groups_user]
      @edit[:new][:description]  = params[:description]       if params[:description]
      @edit[:new][:role]         = params[:group_role]        if params[:group_role]
      @edit[:new][:group_tenant] = params[:group_tenant].to_i if params[:group_tenant]
      @edit[:new][:lookup]       = (params[:lookup] == "1")   if params[:lookup]
      @edit[:new][:user]         = params[:user]              if params[:user]
      @edit[:new][:user_id]      = params[:user_id]           if params[:user_id]
      @edit[:new][:user_pwd]     = params[:password]          if params[:password]
    end
    if params[:check]                               
      if params[:tree_typ] == "myco"                
        if params[:check] == "0"                    
          @edit[:new][:filters].delete(params[:id].split('___').last)   
        else                                        
          cat, tag = params[:id].split('___').last.split("-")         
          @edit[:new][:filters][params[:id].split('___').last] = "/managed/#{cat}/#{tag}" 
        end
      else                                          
        if params[:check] == "0"                    
          @edit[:new][:belongsto].delete(params[:id].split('___').last) 
        else                                        
          objc, objid = params[:id].split('___').last.split("_")      
          tobj = objc.constantize.find(objid)       
          @edit[:new][:belongsto][params[:id].split('___').last] = MiqFilter.object2belongsto(tobj) 
        end
      end
    end
    params[:tree_typ] ? params[:tree_typ] + "_tree" : nil
  end
def rbac_group_get_form_vars if %w( up down ) . include? ( params [ :button ] ) move_cols_up if params [ :button ] == "up" move_cols_down if params [ :button ] == "down" else @edit [ :new ] [ :description ] = params [ :ldap_groups_user ] if params [ :ldap_groups_user ] @edit [ :new ] [ :description ] = params [ :description ] if params [ :description ] @edit [ :new ] [ :role ] = params [ :group_role ] if params [ :group_role ] @edit [ :new ] [ :group_tenant ] = params [ :group_tenant ] . to_i if params [ :group_tenant ] @edit [ :new ] [ :lookup ] = ( params [ :lookup ] == "1" ) if params [ :lookup ] @edit [ :new ] [ :user ] = params [ :user ] if params [ :user ] @edit [ :new ] [ :user_id ] = params [ :user_id ] if params [ :user_id ] @edit [ :new ] [ :user_pwd ] = params [ :password ] if params [ :password ] end if params [ :check ] if params [ :tree_typ ] == "myco" if params [ :check ] == "0" @edit [ :new ] [ :filters ] . delete ( params [ :id ] . split ( '___' ) . last ) else cat , tag = params [ :id ] . split ( '___' ) . last . split ( "-" ) @edit [ :new ] [ :filters ] [ params [ :id ] . split ( '___' ) . last ] = "/managed/#{cat}/#{tag}" end else if params [ :check ] == "0" @edit [ :new ] [ :belongsto ] . delete ( params [ :id ] . split ( '___' ) . last ) else objc , objid = params [ :id ] . split ( '___' ) . last . split ( "_" ) tobj = objc . constantize . find ( objid ) @edit [ :new ] [ :belongsto ] [ params [ :id ] . split ( '___' ) . last ] = MiqFilter . object2belongsto ( tobj ) end end end params [ :tree_typ ] ? params [ :tree_typ ] + "_tree" : nil end
Get variables from group edit form
Get variables from group edit form
# User checked/unchecked a tree node # MyCompany tag checked #   unchecked #     Remove the tag from the filters array #   checked #     Get the category and tag # Put them in the hash # Belongsto tag checked #   unchecked #     Remove the tag from the belongsto hash #   checked #     Get the object class and id #     Get the record # Put the tag into the belongsto hash