zoukankan      html  css  js  c++  java
  • Redmine 删除 project 中的 public 选项

    缘由:由于manager的错误设置,导致本不该public的项目设置成public

    诉求:去除项目新建及设置时的public勾选

    1、查找日志

    由于redmine是拿ruby编写的,且主页等都是由html.erb生成的,查找源码比较麻烦,该选项为“Public”,对应源码里有很多混淆项。基于此,考虑去看一下log。
    查看日志并保持窗口:tail -f -n 100 production.log
    我们将某个无关紧要的项目设置成public并立即设置成non-public。观察上述日志的变化。
    在查看日志的时候,发现有一个字段“is_public”如下:

    ./production.log:  Parameters: {"utf8"=>"✓", "authenticity_token"=>"I2u5UTstAZCtEHOuXzNhMn005kbHxaaFMlYohspiqM+STGLxily+xgBmdjvlbyeYsmp9yjPGGYFK/wBMY0X/4Q==", "project"=>{"name"=>"*****", "description"=>"", "homepage"=>"", "is_public"=>"1", "parent_id"=>"262", "inherit_members"=>"0", "custom_field_values"=>{"35"=>"125", "36"=>"", "37"=>"", "38"=>"", "39"=>"", "40"=>"Team management Project"}, "agile_color_attributes"=>{"color"=>""}, "tracker_ids"=>["1", "2", "3", ""], "issue_custom_field_ids"=>[""]}, "commit"=>"Save", "id"=>"*****"}
    

    可以看见 "is_public"=>"1" ,对应的取消public设置时该字段为"is_public"=>"0",可见源码中存在该“is_public”字段的设置。

    2、查找源码字段

    在redmine源码根目录查找:

    $ find . -name *.erb |xargs grep "is_public"
    ./app/views/admin/projects.html.erb:  <th><%=l(:field_is_public)%></th>
    ./app/views/admin/projects.html.erb:  <td><%= checked_image project.is_public? %></td>
    ./app/views/projects/_form.html.erb:<p><%= f.check_box :is_public %></p>
    ./plugins/redmine_agile/app/views/agile_queries/_form.html.erb:      <p><label for="query_is_public"><%=l(:field_is_public)%></label>
    ./plugins/redmine_agile/app/views/agile_queries/_form.html.erb:      <%= check_box 'query', 'is_public',
    ./plugins/redmine_agile/app/views/agile_queries/_form.html.erb:        :disabled => (!@query.new_record? && (@query.project.nil? || (@query.is_public? && !User.current.admin?))) %></p>
    

    可见以上三个文件文件中有对应字段,其中redmine_agile是插件,如果没有安装则无需修改。

    3、修改源代码

    修改三个文件的源码,请先做好文件备份工作!删除以下内容:

    app/views/admin/projects.html.erb
    
      <th><%=l(:field_is_public)%></th>
      <td><%= checked_image project.is_public? %></td>
    
    app/views/projects/_form.html.erb
    
      <p><%= f.check_box :is_public %></p>
    
    plugins/redmine_agile/app/views/agile_queries/_form.html.erb
    
    <p><label for="query_is_public"><%=l(:field_is_public)%></label>
          <%= check_box 'query', 'is_public',
                :onchange => (User.current.admin? ? nil : 'if (this.checked) {$("#query_is_for_all").removeAttr("checked"); $("#query_is_for_all").attr("disabled", true);} else {$("#query_is
    _for_all").removeAttr("disabled");}') %></p>
                              
      <p><label for="query_is_for_all"><%=l(:field_is_for_all)%></label>
      <%= check_box_tag 'query_is_for_all', 1, @query.project.nil?,
            :disabled => (!@query.new_record? && (@query.project.nil? || (@query.is_public? && !User.current.admin?))) %></p>
    

    修改后无需重启apache2,但如需恢复public选项,则请覆盖被修改文件,重启apache2。
    查找字符串参考:http://blog.chinaunix.net/uid-25266990-id-199887.html

  • 相关阅读:
    手把手教你利用create-nuxt-app脚手架创建NuxtJS应用
    初识NuxtJS
    webpack打包Vue应用程序流程
    用选择器代替表格列的筛选功能
    Element-UI
    Spectral Bounds for Sparse PCA: Exact and Greedy Algorithms[贪婪算法选特征]
    Sparse Principal Component Analysis via Rotation and Truncation
    Generalized Power Method for Sparse Principal Component Analysis
    Sparse Principal Component Analysis via Regularized Low Rank Matrix Approximation(Adjusted Variance)
    Truncated Power Method for Sparse Eigenvalue Problems
  • 原文地址:https://www.cnblogs.com/wangbaobao/p/7544476.html
Copyright © 2011-2022 走看看