缘由:由于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

Redmine 删除 project 中的 public 选项的更多相关文章

  1. 删除select中所有option选项jquery代码

    select中所有option选项如何删除,本文使用jquery简单实现下,有此需求的朋友可以参考下,希望对大家有所帮助. 这样写 复制代码代码如下: <select id="sear ...

  2. unity编辑器扩展_02(分别在Hierarchy,Project中创建一个选项)

    在Hierarchy面板创建选项的代码: [MenuItem("GameObject/Test",false,1)]    static void Test1()    {     ...

  3. 删除select中所有option选项

    这样写 <select id="search"> <option>baidu</option> <option>sogou</ ...

  4. 添加删除系统右键菜单(就是上下文菜单,也就是Context Menu)中的一些选项

    随着电脑安装的东西越来越多,右侧菜单也原来越长,很不方面.所以打算清理一下 我删除的大约以下几个,友好一点的都可以配置.当然也可以通过注册表直接删除. 特:注册表备份,即导入导出,避免一失足成千古恨. ...

  5. 报错:①Tog goal specified requires a project to execute but there is no POM in this directory......②说类HelloWorld是公共的, 应在名为 HelloWorld.java 的文件中声明 public class HelloWorld......

    在运行Maven的命令时,在DOS窗口里面必须把目录切换到项目的根部,要不然命令是找不到目的地. 下图是错误示范,项目在Demo02这个目录里,就必须将目录切换到Demo02下,否则DOS窗口只有飘红 ...

  6. [java]删除数组中的某一个元素

    package org.company.project.test; import java.util.Arrays; import java.util.Scanner; public class Ar ...

  7. Java中如何优雅地删除List中的元素

    在工作中的许多场景下,我们都会使用到List这个数据结构,那么同样的有很多场景下需要删除List中的某一个元素或某几个元素,那么我们该如何正确无误地删除List中的元素的,今天我来教大家三种方式. 前 ...

  8. C# 删除字符串中的中文

    /// <summary> /// 删除字符串中的中文 /// </summary> public static string Delete中文(string str) { s ...

  9. Java删除数据库中的数据

    1:删除数据库中数据表中的数据同样也是一个非常用的技术,使用executeUpdate()方法执行用来做删除SQL的语句可以删除数据库表中的数据 2:本案例使用Statement接口中的execute ...

随机推荐

  1. 学习fortran77基础语法

    Program ParamaterDefine Implicit None C FORTRAN变量名和关键字不区分大小写.但调用外部函数的话,需要在编译选项里指定 c 大小写等选项 因为链接器是区分大 ...

  2. BZOJ 3259 [Sdoi2014]数表 (莫比乌斯反演 + 树状数组)

    3529: [Sdoi2014]数表 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 2321  Solved: 1187[Submit][Status ...

  3. Ng第十二课:支持向量机(Support Vector Machines)(一)

    1 目录 支持向量机基本上是最好的有监督学习算法了,从logistic回归出发,引出了SVM,揭示模型间的联系,过渡自然. 2 重新审视logistic回归 Logistic回归目的是从特征学习出一个 ...

  4. 20171126-handler消息机制理解

    1.handler消息机制的理解 http://www.jianshu.com/p/8343a39b8a2c?s_q_s_h_a_r_e_1MTAzNTIwODAxNTExNTg5NTkwMzE0Nz ...

  5. 【repost】对JAVASCRIPT匿名函数的理解(透彻版)

    Query片段: view plaincopy to clipboardprint? (function(){ //这里忽略jQuery所有实现 })(); 半年前初次接触jQuery的时候,我也像其 ...

  6. spring mvc使用ModelAndView时发生No request handling method with name '方法 名' in class [类名]的错误

    我日,下午关于标题错误查了好久,网上啥说法都有, 后来发现是ModelAndView的路径引错了 正确路径应该为: import org.springframework.web.servlet.Mod ...

  7. POJ3320 Jessica's Reading Problem 2017-05-25 19:55 38人阅读 评论(0) 收藏

    Jessica's Reading Problem Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12346   Accep ...

  8. hive 实现类似 contain 包含查询

    如何用hive sql 实现 contain 查询? 需求:判断某个字符串是否在另一个字符串中? 方法: 可以自定义函数,但是用正则匹配regexp更方便 代码如下: 首先,查看regexp正则函数的 ...

  9. [代码优化]PHP代码优化

    // Code snippet 1 $u_id = Hnb_Session::getInstance()->getUserID(); $arr_joinedTribeInfo = array() ...

  10. 火狐浏览器(Firefox)打开EBS form的设置方法

    http://yedward.net/?id=247 客户在使用EBS的时候,很多都是使用IE浏览器打开,但是EBS并不仅仅只是支持IE,对于谷歌浏览器(Chrome).火狐浏览器(Firefox)也 ...