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
Redmine 删除 project 中的 public 选项的更多相关文章
- 删除select中所有option选项jquery代码
select中所有option选项如何删除,本文使用jquery简单实现下,有此需求的朋友可以参考下,希望对大家有所帮助. 这样写 复制代码代码如下: <select id="sear ...
- unity编辑器扩展_02(分别在Hierarchy,Project中创建一个选项)
在Hierarchy面板创建选项的代码: [MenuItem("GameObject/Test",false,1)] static void Test1() { ...
- 删除select中所有option选项
这样写 <select id="search"> <option>baidu</option> <option>sogou</ ...
- 添加删除系统右键菜单(就是上下文菜单,也就是Context Menu)中的一些选项
随着电脑安装的东西越来越多,右侧菜单也原来越长,很不方面.所以打算清理一下 我删除的大约以下几个,友好一点的都可以配置.当然也可以通过注册表直接删除. 特:注册表备份,即导入导出,避免一失足成千古恨. ...
- 报错:①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窗口只有飘红 ...
- [java]删除数组中的某一个元素
package org.company.project.test; import java.util.Arrays; import java.util.Scanner; public class Ar ...
- Java中如何优雅地删除List中的元素
在工作中的许多场景下,我们都会使用到List这个数据结构,那么同样的有很多场景下需要删除List中的某一个元素或某几个元素,那么我们该如何正确无误地删除List中的元素的,今天我来教大家三种方式. 前 ...
- C# 删除字符串中的中文
/// <summary> /// 删除字符串中的中文 /// </summary> public static string Delete中文(string str) { s ...
- Java删除数据库中的数据
1:删除数据库中数据表中的数据同样也是一个非常用的技术,使用executeUpdate()方法执行用来做删除SQL的语句可以删除数据库表中的数据 2:本案例使用Statement接口中的execute ...
随机推荐
- vba中变量作用域
参考:http://club.excelhome.net/thread-1237085-1-1.html 全局变量例子public 变量1 AS IntegerSub LLL()变量1 = 111 ...
- Ng第十五课:异常检测(Anomaly Detection)
15.1 问题的动机 15.2 高斯分布 15.3 算法 15.4 开发和评价一个异常检测系统 15.5 异常检测与监督学习对比 15.6 选择特征 15.7 多元高斯分布(可选) 15 ...
- springboot工程读取配置文件application.yml的写法18045
现在流行springboot框架的项目,里面的默认配置文件为application.yml,我们怎样读取这个配置文件呢? 先贴上我得配置文件吧 目录结构 里面内容 1 写读取配置文件的工具类 @Con ...
- (最长公共子序列 暴力) Common Subsequence (poj 1458)
http://poj.org/problem?id=1458 Description A subsequence of a given sequence is the given sequence w ...
- 7、使用autotools自动产生makefile
通过之前的学习可以知道,makefile拥有复杂的语法结构,编写与维护都不是很方便于是设计出了专门用来生成Makefile的autotools工具,以减轻制作makefile文件的负担. 自主软件主要 ...
- codeforces 925 c big secret
题意: 给你n个数,b[1],b[2],b[3].......,让你重新排列,使a[i]的值递增 a[i]和b的关系: a[i] = b[1]^b[2]^b[3]^....^b[i]; 首先说异或 ...
- pycharm的基本使用
1.设置注释字体的颜色,如下图 2.常用快捷键 Ctrl + Space 基本的代码完成(类.方法.属性) Ctrl + Alt + Space 类名完成 Ctrl + Shift + Enter 语 ...
- 使用nohup后台执行ftp传输命令
因为有的时候会需要长时间传输文件,所以想用nohup 结合shell脚本一起使用,就不用一直在电脑面前了 . nohup 用法: nohup command & 然后就会出现 对应的 pid ...
- [Leet code 2]Two Sum
1 题目 You are given two linked lists representing two non-negative numbers. The digits are stored in ...
- Matlab中函数句柄@的作用及介绍
问:f=@(x)acos(x)表示什么意思?其中@代表什么?答:表示f为函数句柄,@是定义句柄的运算符.f=@(x)acos(x) 相当于建立了一个函数文件:% f.mfunction y=f(x) ...