缘由:由于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. activemq部署

    系统环境 IP salt-master-1:192.168.0.156 salt-master-2:192.168.0.157 node-test-1:192.168.0.158 node-test- ...

  2. windows10 搭建Dubbo

    1.官方文档 http://dubbo.apache.org/zh-cn/docs/admin/ops/dubbo-ops.html 2.下载安装包 https://mirrors.cnnic.cn/ ...

  3. IDEA有用插件总结

    IDEA要查看哪些插件起效了可以通过.IntellijIdeaXxx/config/plugins/availables.xml里查看: 一:Lombok插件,里面很多注解都可以省略许多冗余的代码: ...

  4. PHP continue break 区别 用法

    <?php //continue 跳过当前循环,进行下一个 //break 终止当前循环 $db=new PDO("mysql:host=localhost;dbname=root&q ...

  5. 几种修改Linux主机名的方法

    在安装一些系统时,需要修改hostname,比如安装Hadoop时需要修改主机名,而且主机名不能包含下划线. 实际上,主机名分三种(命令hostnamectl或hostnamectl status可查 ...

  6. js基础学习笔记(零七)

    indexOf() 方法 返回某个指定的字符串值在字符串中首次出现的位置. 语法: stringObject.indexOf(substring, startpos) 参数说明: 注意:如果要检索的字 ...

  7. weat!!团队

    摘要: 团队名称:weat!! 团队成员:刘波 崔和杰 简介: 刘波:性别男,爱好:动漫,徒步旅行.在组内负责程序编写这一部分. 优点:认真负责,不懂就会去问. 崔和杰:性别男,爱好:篮球.在组内负责 ...

  8. Ng第十一课:机器学习系统的设计(Machine Learning System Design)

    11.1  首先要做什么 11.2  误差分析 11.3  类偏斜的误差度量 11.4  查全率和查准率之间的权衡 11.5  机器学习的数据 11.1  首先要做什么 在接下来的视频将谈到机器学习系 ...

  9. info AI drive

    Who we look for Here at comma, we don't care about the source of your education or your traditional ...

  10. Java理论学时第六节。课后作业。

    package Fuction; class Grandparent { public Grandparent() { System.out.println("GrandParent Cre ...