课程资源文件密级BUG修正
This commit is contained in:
parent
0950ac2329
commit
2a1a051362
|
@ -92,57 +92,74 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
##xianbo
|
if params[:repository_scm].to_s == 'Gitlab'
|
||||||
@root_path=RepositoriesHelper::ROOT_PATH
|
# add by nwb
|
||||||
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
|
# 增加对gitlab版本库的支持
|
||||||
@project_path=@root_path+"htdocs/"+@repository_name
|
attrs = pickup_extra_info
|
||||||
@repository_tag=params[:repository][:upassword]
|
@repository = Repository.factory(params[:repository_scm])
|
||||||
@repo_name=User.current.login.to_s+"_"+params[:repository][:identifier]
|
@repository.safe_attributes = params[:repository]
|
||||||
logger.info "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+": "+@repository_tag
|
if attrs[:attrs_extra].keys.any?
|
||||||
logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name
|
@repository.merge_extra_info(attrs[:attrs_extra])
|
||||||
attrs = pickup_extra_info
|
end
|
||||||
if((@repository_tag!="")&¶ms[:repository_scm]=="Git")
|
@repository.project = @project
|
||||||
|
if request.post? && @repository.save
|
||||||
|
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||||
|
else
|
||||||
|
render :action => 'new'
|
||||||
|
end
|
||||||
|
else # 原逻辑
|
||||||
|
##xianbo
|
||||||
|
@root_path=RepositoriesHelper::ROOT_PATH
|
||||||
|
@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]
|
||||||
|
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!="")&¶ms[:repository_scm]=="Git")
|
||||||
params[:repository][:url]=@project_path
|
params[:repository][:url]=@project_path
|
||||||
end
|
end
|
||||||
###xianbo
|
###xianbo
|
||||||
@repository = Repository.factory(params[:repository_scm])
|
@repository = Repository.factory(params[:repository_scm])
|
||||||
@repository.safe_attributes = params[:repository]
|
@repository.safe_attributes = params[:repository]
|
||||||
if attrs[:attrs_extra].keys.any?
|
if attrs[:attrs_extra].keys.any?
|
||||||
@repository.merge_extra_info(attrs[:attrs_extra])
|
@repository.merge_extra_info(attrs[:attrs_extra])
|
||||||
end
|
end
|
||||||
#by xianbo
|
#by xianbo
|
||||||
|
|
||||||
@repository.project = @project
|
@repository.project = @project
|
||||||
if request.post? && @repository.save
|
if request.post? && @repository.save
|
||||||
if(params[:repository_scm]=="Git")
|
if(params[:repository_scm]=="Git")
|
||||||
system "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+" "+@repository_tag
|
system "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+" "+@repository_tag
|
||||||
system "echo -e '"+@repo_name+"-write:"+
|
system "echo -e '"+@repo_name+"-write:"+
|
||||||
" "+@repo_name+"' >> "+@root_path+"group.passwd"
|
" "+@repo_name+"' >> "+@root_path+"group.passwd"
|
||||||
system "mkdir "+@root_path+"htdocs/"+User.current.login.to_s
|
system "mkdir "+@root_path+"htdocs/"+User.current.login.to_s
|
||||||
system "git init --bare "+@project_path
|
system "git init --bare "+@project_path
|
||||||
system "mv "+@project_path+"/hooks/post-update{.sample,}"
|
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 "echo -e 'Allow from all \n Order Deny,Allow \n "+
|
system "echo -e 'Allow from all \n Order Deny,Allow \n "+
|
||||||
"<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
|
"<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
|
||||||
"Require group "+@repo_name+"-write \n "+
|
"Require group "+@repo_name+"-write \n "+
|
||||||
"</Limit> \n ' >> "+
|
"</Limit> \n ' >> "+
|
||||||
@root_path+"htdocs/"+ @repository_name+"/.htaccess"
|
@root_path+"htdocs/"+ @repository_name+"/.htaccess"
|
||||||
system "cd "+@project_path+" ;git update-server-info"
|
system "cd "+@project_path+" ;git update-server-info"
|
||||||
# if(create_repo_file&&create_passwd&&create_group&&init_repository&&add_privilege&&init_server_info)
|
# if(create_repo_file&&create_passwd&&create_group&&init_repository&&add_privilege&&init_server_info)
|
||||||
# else
|
# else
|
||||||
# logger.info "An error occured when authenticating "+"create passwd"+@creat_passwd+"create_group"+
|
# logger.info "An error occured when authenticating "+"create passwd"+@creat_passwd+"create_group"+
|
||||||
# crate_group+"create repository file "+create_repo_file+"init repository"+init_repostory+
|
# crate_group+"create repository file "+create_repo_file+"init repository"+init_repostory+
|
||||||
# "aad privilege to rpository"+add_privilege+"init server infos"+init_server_info
|
# "aad privilege to rpository"+add_privilege+"init server infos"+init_server_info
|
||||||
# end
|
# end
|
||||||
@repository.update_attributes(:login => User.current.login.to_s)
|
@repository.update_attributes(:login => User.current.login.to_s)
|
||||||
end
|
end
|
||||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||||
else if(@repository_tag)
|
else if(@repository_tag)
|
||||||
render :action => 'newrepo', :layout =>'base_projects'
|
render :action => 'newrepo', :layout =>'base_projects'
|
||||||
else
|
else
|
||||||
render :action => 'new', :layout =>'base_projects'
|
render :action => 'new', :layout =>'base_projects'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% container.attachments.each do |file| %>
|
<% container.attachments.each do |file| %>
|
||||||
<%if file.is_public == 0 && !User.current.member_of?(@project)%>
|
<%if file.is_public == 0 && !User.current.member_of_course?(@course)%>
|
||||||
<%next%>
|
<%next%>
|
||||||
<%end%>
|
<%end%>
|
||||||
<tr class="file <%= cycle("odd", "odd") %>">
|
<tr class="file <%= cycle("odd", "odd") %>">
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<% @containers.each do |container| %>
|
<% @containers.each do |container| %>
|
||||||
<% next if container.attachments.empty? -%>
|
<% next if container.attachments.empty? -%>
|
||||||
<% container.attachments.each do |file| %>
|
<% container.attachments.each do |file| %>
|
||||||
<% if file.is_public == 0 && !User.current.member_of?(@project) %>
|
<% if file.is_public == 0 && !User.current.member_of_course?(@course) %>
|
||||||
<% next %>
|
<% next %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if isTypeOk(file, selAttachType, selContentType) %>
|
<% if isTypeOk(file, selAttachType, selContentType) %>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20140711012924) do
|
ActiveRecord::Schema.define(:version => 20140714021812) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -379,6 +379,7 @@ ActiveRecord::Schema.define(:version => 20140711012924) do
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.datetime "created_on"
|
t.datetime "created_on"
|
||||||
t.integer "user_id", :default => 0
|
t.integer "user_id", :default => 0
|
||||||
|
t.integer "is_public", :default => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "documents", ["category_id"], :name => "index_documents_on_category_id"
|
add_index "documents", ["category_id"], :name => "index_documents_on_category_id"
|
||||||
|
|
Loading…
Reference in New Issue