<commit_before>- if @edit
  - url = url_for(:action => 'rbac_group_field_changed',
                  :id     => "#{@edit[:group_id] || "new"}")
  - combo_url = "/ops/rbac_group_field_changed/#{@edit[:group_id] || 'new'}"
= render :partial => "layouts/flash_msg"
#main_div
  %h3
    = _("Group Information")
  - if @edit
    = render :partial => "ldap_auth_users"
  .form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _("Description")
      .col-md-8
        - if !@edit
          = h(@group.description)
        - else
          = text_field_tag("description",
                           @edit[:new][:description],
                           :maxlength         => 50,
                           :class => "form-control",
                           "data-miq_observe" => {:interval => '.5',
                                                  :url      => url}.to_json)
          = check_box_tag("lookup",
                          "1",
                          false,
                          "data-miq_observe_checkbox" => {:url => url}.to_json)
          = _("(Look Up LDAP Groups)")
          = javascript_tag(javascript_focus('description'))
    .form-group
      %label.col-md-2.control-label
        = _("Role")
      .col-md-8
        - if !@edit
          - if @group.miq_user_role
            - if role_allows(:feature => "rbac_role_show")
              - params = {:class   => "pointer",
                          :onclick => "miqDynatreeActivateNode('rbac_tree', 'ur-#{to_cid(@group.miq_user_role.id)}');",
                          :title   => _("View this Role")}
            - else
              - params = {}
            %span.product.product-role{params}
              = h(@group.miq_user_role.name)
        - else
          = select_tag('group_role',
              options_for_select(@edit[:roles].sort, @edit[:new][:role]),
              :class  => "selectpicker")
          :javascript
            miqInitSelectPicker();
            miqSelectPickerEvent("group_role", "#{combo_url}")
    .form-group
      %label.col-md-2.control-label
        = _("Project/Tenant")
      .col-md-8
        - if !@edit
          - if @group.tenant
            - tenant = @group.tenant
            - params = {:class => "product product-#{tenant.divisible ? "tenant" : "project"}"}
            - if role_allows(:feature => "rbac_tenant_show")
              - params[:class] = "#{params[:class]} pointer"
              - params.merge!({:onclick => "miqDynatreeActivateNode('rbac_tree', 'tn-#{to_cid(tenant.id)}');",
                               :title   => _("View this #{tenant.divisible ? "Tenant" : "Project"}")})
            %span{params}
              = h(tenant.name)
        - else
          = select_tag('group_tenant',
              grouped_options_for_select(@edit[:projects_tenants], @edit[:new][:group_tenant]),
               :class  => "selectpicker")
          :javascript
            miqSelectPickerEvent("group_tenant", "#{combo_url}")

    - unless @edit
      .form-group
        %label.col-md-2.control-label
          = _("Users in this Group")
        .col-md-8
          - @group.users.sort_by { |a| a.name.downcase }.each do |u|
            - if role_allows(:feature => "rbac_user_show")
              - params = {:class   => "pointer",
                          :onclick => "miqDynatreeActivateNode('rbac_tree', 'u-#{to_cid(u.id)}');",
                          :title   => _("View this User")}
            - else
              - params = {}
            %span.pficon.pficon-user{params}
              = h(u.name)
            %br
      - unless @edit
        = render :partial => "rbac_tag_box"
      - if @edit
        #group_lookup{:style => "display:none"}
          %fieldset
            %h3
              = _("LDAP Group Look Up")
            .form-horizontal
              .form-group#user_id_ext_auth_form_group
                %label.col-md-2.control-label
                  = _("User to Look Up")
                .col-md-8
                  = text_field_tag("user",
                                   @edit[:new][:user],
                                   :maxlength         => 255,
                                   :class => "form-control",
                                   "data-miq_observe" => {:interval => '.5',
                                                          :url      => url}.to_json)
                .col-md-12{:align => "right", :valign => "bottom"}
                  = link_to("Retrieve",
                            {:action => "rbac_group_user_lookup",
                             :button => "submit",
                             :id     => "#{@edit[:group_id] || "new"}"},
                             :class => "btn btn-primary",
                             :alt   => _("LDAP Group Lookup"),
                             "data-miq_sparkle_on"  => true,
                             "data-miq_sparkle_off" => true,
                             :remote                => true,
                             :title                 => _("LDAP Group Lookup"))

              .form-group#user_id_form_group
                %label.col-md-2.control-label
                  = _("User to Look Up")
                .col-md-8
                  = text_field_tag("user",
                                   @edit[:new][:user],
                                   :maxlength         => 255,
                                   :class => "form-control",
                                   "data-miq_observe" => {:interval => '.5',
                                                          :url      => url}.to_json)

              .form-group#user_name_form_group
                %label.col-md-2.control-label
                  = _("Username")
                .col-md-8
                  = text_field_tag("user_id",
                                   @edit[:new][:user_id],
                                   :maxlength         => 255,
                                   :class => "form-control",
                                   "data-miq_observe" => {:interval => '.5',
                                                          :url      => url}.to_json)

              .form-group#user_password_form_group
                %label.col-md-2.control-label
                  = _("Password")
                .col-md-8
                  = password_field_tag("password",
                                       @edit[:new][:password],
                                       :maxlength         => 50,
                                       :class => "form-control",
                                       "data-miq_observe" => {:interval => '.5',
                                                              :url      => url}.to_json)
                .col-md-12{:align => "right", :valign => "bottom"}
                  = link_to("Retrieve",
                            {:action => "rbac_group_user_lookup",
                             :button => "submit",
                             :id     => "#{@edit[:group_id] || "new"}"},
                             :class => "btn btn-primary",
                             :alt   => _("LDAP Group Lookup"),
                             "data-miq_sparkle_on"  => true,
                             "data-miq_sparkle_off" => true,
                             :remote                => true,
                             :title                 => _("LDAP Group Lookup"))

  %hr
  %h3
    = @edit ? _("Assign Filters") : _("Assigned Filters (read only)")
  #rbac_group_tabs
    %ul.nav.nav-tabs
      = miq_tab_header('customer_tags') do
        = escape_javascript(current_tenant.name)
        = _("Tags")
      = miq_tab_header('hosts_clusters') do
        = _("#{title_for_hosts} & #{title_for_clusters}")
      = miq_tab_header('vms_templates') do
        = _("VMs & Templates")
    .tab-content
      = miq_tab_content('customer_tags') do
        %br/
        = _("This user is limited to items with the selected tags.")
        %br/
        %br/
        #myco_treebox{:style => "color:#000"}
        = render(:partial => "layouts/dynatree",
                 :locals  => {:tree_id        => "myco_treebox",
                              :tree_name      => "myco_tree",
                              :json_tree      => session[:myco_tree],
                              :onmousein      => "miqOnMouseInHostNet",
                              :onmouseout     => "miqOnMouseOutHostNet",
                              :oncheck        => @edit.nil? ? nil : "miqOnCheckUserFilters",
                              :disable_checks => @edit.nil?,
                              :check_url      => "ops/rbac_group_field_changed/#{@group.id || "new"}___",
                              :checkboxes     => true})
      = miq_tab_content('hosts_clusters') do
        %br/
        = _("This user is limited to the selected items and their children.")
        %br/
        %br/
        #hac_treebox{:style => "color:#000"}
        = render(:partial => "layouts/dynatree",
                 :locals  => {:tree_id        => "hac_treebox",
                              :tree_name      => "hac_tree",
                              :json_tree      => session[:hac_tree],
                              :onmousein      => "miqOnMouseInHostNet",
                              :onmouseout     => "miqOnMouseOutHostNet",
                              :oncheck        => @edit.nil? ? nil : "miqOnCheckUserFilters",
                              :disable_checks => @edit.nil?,
                              :check_url      => "ops/rbac_group_field_changed/#{@group.id || "new"}___",
                              :checkboxes     => true})
      = miq_tab_content('vms_templates') do
        %br/
        = _("This user is limited to the selected folders and their children.")
        %br/
        %br/
        #vat_treebox{:style => "color:#000"}
        = render(:partial => "layouts/dynatree",
                 :locals  => {:tree_id        => "vat_treebox",
                              :tree_name      => "vat_tree",
                              :json_tree      => session[:vat_tree],
                              :onmousein      => "miqOnMouseInHostNet",
                              :onmouseout     => "miqOnMouseOutHostNet",
                              :oncheck        => @edit.nil? ? nil : "miqOnCheckUserFilters",
                              :disable_checks => @edit.nil?,
                              :check_url      => "/ops/rbac_group_field_changed/#{@group.id || "new"}___",
                              :checkboxes     => true})
:javascript
  miq_tabs_init('#rbac_group_tabs');
%script{:type => "text/javascript"}
  - if get_vmdb_config[:authentication][:mode] == "httpd"
    $('#user_id_ext_auth_form_group').show();
    $('#user_id_form_group').hide();
    $('#user_name_form_group').hide();
    $('#user_password_form_group').hide();
  - else
    $('#user_id_ext_auth_form_group').hide();
    $('#user_id_form_group').show();
    $('#user_name_form_group').show();
    $('#user_password_form_group').show();
<commit_msg>fix LDAP group look up<commit_after>- if @edit
  - url = url_for(:action => 'rbac_group_field_changed',
                  :id     => "#{@edit[:group_id] || "new"}")
  - combo_url = "/ops/rbac_group_field_changed/#{@edit[:group_id] || 'new'}"
= render :partial => "layouts/flash_msg"
#main_div
  %h3
    = _("Group Information")
  - if @edit
    = render :partial => "ldap_auth_users"
  .form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _("Description")
      .col-md-8
        - if !@edit
          = h(@group.description)
        - else
          = text_field_tag("description",
                           @edit[:new][:description],
                           :maxlength         => 50,
                           :class => "form-control",
                           "data-miq_observe" => {:interval => '.5',
                                                  :url      => url}.to_json)
          = check_box_tag("lookup",
                          "1",
                          false,
                          "data-miq_observe_checkbox" => {:url => url}.to_json)
          = _("(Look Up LDAP Groups)")
          = javascript_tag(javascript_focus('description'))
    .form-group
      %label.col-md-2.control-label
        = _("Role")
      .col-md-8
        - if !@edit
          - if @group.miq_user_role
            - if role_allows(:feature => "rbac_role_show")
              - params = {:class   => "pointer",
                          :onclick => "miqDynatreeActivateNode('rbac_tree', 'ur-#{to_cid(@group.miq_user_role.id)}');",
                          :title   => _("View this Role")}
            - else
              - params = {}
            %span.product.product-role{params}
              = h(@group.miq_user_role.name)
        - else
          = select_tag('group_role',
              options_for_select(@edit[:roles].sort, @edit[:new][:role]),
              :class  => "selectpicker")
          :javascript
            miqInitSelectPicker();
            miqSelectPickerEvent("group_role", "#{combo_url}")
    .form-group
      %label.col-md-2.control-label
        = _("Project/Tenant")
      .col-md-8
        - if !@edit
          - if @group.tenant
            - tenant = @group.tenant
            - params = {:class => "product product-#{tenant.divisible ? "tenant" : "project"}"}
            - if role_allows(:feature => "rbac_tenant_show")
              - params[:class] = "#{params[:class]} pointer"
              - params.merge!({:onclick => "miqDynatreeActivateNode('rbac_tree', 'tn-#{to_cid(tenant.id)}');",
                               :title   => _("View this #{tenant.divisible ? "Tenant" : "Project"}")})
            %span{params}
              = h(tenant.name)
        - else
          = select_tag('group_tenant',
              grouped_options_for_select(@edit[:projects_tenants], @edit[:new][:group_tenant]),
               :class  => "selectpicker")
          :javascript
            miqSelectPickerEvent("group_tenant", "#{combo_url}")

    - unless @edit
      .form-group
        %label.col-md-2.control-label
          = _("Users in this Group")
        .col-md-8
          - @group.users.sort_by { |a| a.name.downcase }.each do |u|
            - if role_allows(:feature => "rbac_user_show")
              - params = {:class   => "pointer",
                          :onclick => "miqDynatreeActivateNode('rbac_tree', 'u-#{to_cid(u.id)}');",
                          :title   => _("View this User")}
            - else
              - params = {}
            %span.pficon.pficon-user{params}
              = h(u.name)
            %br
    - unless @edit
      = render :partial => "rbac_tag_box"
    - if @edit
      #group_lookup{:style => "display:none"}
        %hr
        %h3
          = _("LDAP Group Look Up")
        .form-horizontal
          .form-group#user_id_ext_auth_form_group
            %label.col-md-2.control-label
              = _("User to Look Up")
            .col-md-8
              = text_field_tag("user",
                               @edit[:new][:user],
                               :maxlength         => 255,
                               :class => "form-control",
                               "data-miq_observe" => {:interval => '.5',
                                                      :url      => url}.to_json)
            .col-md-12{:align => "right", :valign => "bottom"}
              = link_to("Retrieve",
                        {:action => "rbac_group_user_lookup",
                         :button => "submit",
                         :id     => "#{@edit[:group_id] || "new"}"},
                         :class => "btn btn-primary",
                         :alt   => _("LDAP Group Lookup"),
                         "data-miq_sparkle_on"  => true,
                         "data-miq_sparkle_off" => true,
                         :remote                => true,
                         :title                 => _("LDAP Group Lookup"))

          .form-group#user_id_form_group
            %label.col-md-2.control-label
              = _("User to Look Up")
            .col-md-8
              = text_field_tag("user",
                               @edit[:new][:user],
                               :maxlength         => 255,
                               :class => "form-control",
                               "data-miq_observe" => {:interval => '.5',
                                                      :url      => url}.to_json)

          .form-group#user_name_form_group
            %label.col-md-2.control-label
              = _("Username")
            .col-md-8
              = text_field_tag("user_id",
                               @edit[:new][:user_id],
                               :maxlength         => 255,
                               :class => "form-control",
                               "data-miq_observe" => {:interval => '.5',
                                                      :url      => url}.to_json)

          .form-group#user_password_form_group
            %label.col-md-2.control-label
              = _("Password")
            .col-md-8
              = password_field_tag("password",
                                   @edit[:new][:password],
                                   :maxlength         => 50,
                                   :class => "form-control",
                                   "data-miq_observe" => {:interval => '.5',
                                                          :url      => url}.to_json)
            .col-md-12{:align => "right", :valign => "bottom"}
              = link_to("Retrieve",
                        {:action => "rbac_group_user_lookup",
                         :button => "submit",
                         :id     => "#{@edit[:group_id] || "new"}"},
                         :class => "btn btn-primary",
                         :alt   => _("LDAP Group Lookup"),
                         "data-miq_sparkle_on"  => true,
                         "data-miq_sparkle_off" => true,
                         :remote                => true,
                         :title                 => _("LDAP Group Lookup"))

  %hr
  %h3
    = @edit ? _("Assign Filters") : _("Assigned Filters (read only)")
  #rbac_group_tabs
    %ul.nav.nav-tabs
      = miq_tab_header('customer_tags') do
        = escape_javascript(current_tenant.name)
        = _("Tags")
      = miq_tab_header('hosts_clusters') do
        = _("#{title_for_hosts} & #{title_for_clusters}")
      = miq_tab_header('vms_templates') do
        = _("VMs & Templates")
    .tab-content
      = miq_tab_content('customer_tags') do
        %br/
        = _("This user is limited to items with the selected tags.")
        %br/
        %br/
        #myco_treebox{:style => "color:#000"}
        = render(:partial => "layouts/dynatree",
                 :locals  => {:tree_id        => "myco_treebox",
                              :tree_name      => "myco_tree",
                              :json_tree      => session[:myco_tree],
                              :onmousein      => "miqOnMouseInHostNet",
                              :onmouseout     => "miqOnMouseOutHostNet",
                              :oncheck        => @edit.nil? ? nil : "miqOnCheckUserFilters",
                              :disable_checks => @edit.nil?,
                              :check_url      => "ops/rbac_group_field_changed/#{@group.id || "new"}___",
                              :checkboxes     => true})
      = miq_tab_content('hosts_clusters') do
        %br/
        = _("This user is limited to the selected items and their children.")
        %br/
        %br/
        #hac_treebox{:style => "color:#000"}
        = render(:partial => "layouts/dynatree",
                 :locals  => {:tree_id        => "hac_treebox",
                              :tree_name      => "hac_tree",
                              :json_tree      => session[:hac_tree],
                              :onmousein      => "miqOnMouseInHostNet",
                              :onmouseout     => "miqOnMouseOutHostNet",
                              :oncheck        => @edit.nil? ? nil : "miqOnCheckUserFilters",
                              :disable_checks => @edit.nil?,
                              :check_url      => "ops/rbac_group_field_changed/#{@group.id || "new"}___",
                              :checkboxes     => true})
      = miq_tab_content('vms_templates') do
        %br/
        = _("This user is limited to the selected folders and their children.")
        %br/
        %br/
        #vat_treebox{:style => "color:#000"}
        = render(:partial => "layouts/dynatree",
                 :locals  => {:tree_id        => "vat_treebox",
                              :tree_name      => "vat_tree",
                              :json_tree      => session[:vat_tree],
                              :onmousein      => "miqOnMouseInHostNet",
                              :onmouseout     => "miqOnMouseOutHostNet",
                              :oncheck        => @edit.nil? ? nil : "miqOnCheckUserFilters",
                              :disable_checks => @edit.nil?,
                              :check_url      => "/ops/rbac_group_field_changed/#{@group.id || "new"}___",
                              :checkboxes     => true})
:javascript
  miq_tabs_init('#rbac_group_tabs');
%script{:type => "text/javascript"}
  - if get_vmdb_config[:authentication][:mode] == "httpd"
    $('#user_id_ext_auth_form_group').show();
    $('#user_id_form_group').hide();
    $('#user_name_form_group').hide();
    $('#user_password_form_group').hide();
  - else
    $('#user_id_ext_auth_form_group').hide();
    $('#user_id_form_group').show();
    $('#user_name_form_group').show();
    $('#user_password_form_group').show();

{'fraction_non_alphanumeric': 0.13880097243245723, 'fraction_numerical': 0.004678684464015412, 'mean_word_length': 1.201110550227158, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 215, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 44, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1358340', 'n_tokens_mistral': 6211, 'n_tokens_neox': 6080, 'n_words': 944}