This commit is contained in:
Administrator 2013-08-21 22:14:02 +08:00
parent e53a9634a2
commit 36e0113f73
4 changed files with 28 additions and 22 deletions

View File

@ -18,7 +18,8 @@
class BoardsController < ApplicationController
layout 'base_projects'#by young
default_search_scope :messages
before_filter :find_project_by_project_id, :find_board_if_available, :authorize
before_filter :find_project_by_project_id, :find_board_if_available
before_filter :authorize, :except => [:new, :show, :create]
accept_rss_auth :index, :show
helper :sort

View File

@ -21,7 +21,7 @@ class MessagesController < ApplicationController
before_filter :find_board, :only => [:new, :preview]
before_filter :find_attachments, :only => [:preview]
before_filter :find_message, :except => [:new, :preview]
before_filter :authorize, :except => [:preview, :edit, :destroy]
before_filter :authorize, :except => [:preview, :edit, :destroy, :new]
helper :boards
helper :watchers

View File

@ -33,7 +33,7 @@ class RepositoriesController < ApplicationController
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo]
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
before_filter :authorize , :except => [:newrepo,:newcreate]
before_filter :authorize , :except => [:newrepo,:newcreate,:fork]
accept_rss_auth :revisions
@ -55,19 +55,24 @@ class RepositoriesController < ApplicationController
end
def fork
@repository_url = params[:repository_url]
# @repository.url
# system "htpasswd -mb "+@root_path+"user.passwd "+params[:repository][:identifier]+" "+@upasswd
# system "echo -e '"+params[:project_id]+"-"+params[:repository][:identifier]+"-write:"+
# " "+params[:repository][:identifier]+"' >> "+@root_path+"group.passwd"
# system "git init --bare "+@project_path
system "git clone --bare "+@repository_url
# system "mv "+@project_path+"/hooks/post-update{.sample,}"
# system "chmod a+x"+@project_path+"/hooks/post-update"
# system "chmod a+x "+@project_path+"/hooks/post-update"
# system "."+@project_path+"/hooks/post-update"
# system "echo -e 'Allow from all \n Order Deny,Allow \n "+
# "<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
# "Require group "+params[:project_id]+"-"+params[:repository][:identifier]+"-write \n "+
# "</Limit> \n ' >>"+
# @project_path+"/.htaccess"
render :action => "show"
flash[:notice] = l(:label_notice_fork_successed)
@repositories = @project.repositories
render :action => 'show', :layout => 'base_projects'
end
def create
@ -76,8 +81,9 @@ class RepositoriesController < ApplicationController
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
@project_path=@root_path+"htdocs/"+@repository_name
@repository_tag=params[:repository][:upassword]
@repo_name=User.current.login.to_s+"-"+params[:repository][:identifier]
@middle=User.current.login.to_s+"-"+params[:repository][:identifier]+"-write:"
@repo_name=User.current.login.to_s+"_"+params[:repository][:identifier]
logger.info "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+": "+@repository_tag
logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name
attrs = pickup_extra_info
if((@repository_tag!="")&&params[:repository_scm]=="Git")
params[:repository][:url]=@project_path
@ -93,9 +99,8 @@ class RepositoriesController < ApplicationController
@repository.project = @project
if request.post? && @repository.save
if(params[:repository_scm]=="Git")
system "htpasswd -mb "+@root_path+" "+@repo_name+" "+@repository_tag
logger.info "htpasswd -mb "+@root_path+" "+@repo_name+" "+@repository_tag+create_passwd
system "echo -e '\n"+@repo_name+"-write:"+
system "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+" "+@repository_tag
system "echo -e '"+@repo_name+"-write:"+
" "+@repo_name+"' >> "+@root_path+"group.passwd"
system "mkdir "+@root_path+"htdocs/"+User.current.login.to_s
system "git init --bare "+@project_path
@ -172,10 +177,14 @@ class RepositoriesController < ApplicationController
def destroy
@root_path="/home/pdl/redmine-2.3.2-0/apache2/"
@repo_name=User.current.login.to_s+"_"+@repository.identifier.to_s
@repository_name=User.current.login.to_s+"/"+@repository.identifier.to_s+".git"
@middle=User.current.login.to_s+"_"+@repository.identifier.to_s+"-write:"
@repository.destroy if request.delete?
redirect_to settings_project_path(@project, :tab => 'repositories')
if(@repository.type=="Repository::Git")
if(@repository.type=="Repository::Git")
logger.info "destory the repository value"+"root path"+@root_path+"repo_name"+@repo_name+
"repository_name"+@repository_name+"user group"+@middle
system "sed -i /"+@repo_name+"/{d} "+@root_path+"user.passwd"
system "sed -i /"+@middle+"/{d} "+@root_path+"group.passwd"
system "rm -r "+@root_path+"htdocs/"+@repository_name

View File

@ -1,9 +1,10 @@
<!--add by huang-->
<div style="padding-bottom: 10px">
<h3 style="padding-top:0px;"><%= l(:field_issue) %>
<div style="padding-bottom: 10px;float:right;font-size:11px;">
<%= link_to l(:label_issue_new), { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new,
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }, :class => 'icon icon-add' %>
</div>
</h3>
<div class="contextual">
<% if !@query.new_record? && @query.editable_by?(User.current) %>
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
@ -19,7 +20,7 @@
<div id="query_form_content" class="hide-when-print">
<fieldset id="filters" style="width:650px;" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
<legend onclick="toggleFieldset(this);">
<%= l(:label_issue_query_condition) %>
<%= l(:label_filter_plural) %>
</legend>
<div style="<%= @query.new_record? ? "" : "display: none;" %>">
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
@ -53,13 +54,8 @@
</div>
<p class="buttons hide-when-print">
<%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
<%= link_to l(:label_issue_cancel_query), { :set_filter => 1, :project_id => @project }, :class => 'icon icon-reload' %>
<% if @query.new_record? && User.current.allowed_to?(:save_queries, @project, :global => true) %>
<%= link_to_function l(:button_save),
"$('#query_form').attr('action', '#{ @project ? new_project_query_path(@project) : new_query_path }'); submit_query_form('query_form')",
:class => 'icon icon-save' %>
<% end %>
<%= link_to_function l(:button_apply), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
<%= link_to l(:button_clear), { :set_filter => 1, :project_id => @project }, :class => 'icon icon-reload' %>
</p>
<% end %>