<%= l(:label_project_overview)%>:
-
<%= l(:label_tag)%>:
-<%= l(:label_project_overview)%>:
+
<%= l(:label_tag)%>:
+请选择项目类型:
--
-
- id="development_group"/> -
- id="research_group"/> -
- id="friend_organization"/> -
diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 7ccfb0e10..4a27f02ff 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -32,13 +32,17 @@ class BoardsController < ApplicationController #modify by nwb @flag = params[:flag] || false if @project - @boards = @project.boards.includes(:last_message => :author).all - @boards = [] << @boards[0] if @boards.any? - if @boards.size == 1 - @board = @boards.first - show and return + if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin? + render_403 + else + @boards = @project.boards.includes(:last_message => :author).all + @boards = [] << @boards[0] if @boards.any? + if @boards.size == 1 + @board = @boards.first + show and return + end + render :layout => false if request.xhr? end - render :layout => false if request.xhr? elsif @course if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) @boards = @course.boards.includes(:last_message => :author).all diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 96807d2dc..06a157c0f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -676,11 +676,11 @@ class ProjectsController < ApplicationController true end - # added by huang - def watcherlist - if @watched - @users -= watched.watcher_users + if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin? + render_403 + else + @users -= watched.watcher_users if @watched end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2a10af260..ace4ae903 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -383,6 +383,8 @@ class UsersController < ApplicationController # scope = User.logged.status(@status) # @search_by = params[:search_by] ? params[:search_by][:id] : 0 # scope = scope.like(params[:name],@search_by) if params[:name].present? + @search_by = params[:search_by] ? params[:search_by] : 0 + us = UsersService.new scope = us.search_user params @user_count = scope.count diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 3d6772ea8..cc6c4f47e 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -85,6 +85,9 @@ class WordsController < ApplicationController elsif @journal_destroyed.jour_type == "Course" @course = Course.find @journal_destroyed.jour_id @jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count + elsif @journal_destroyed.jour_type == "Principal" + @user = User.find(@journal_destroyed.jour_id) + @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count end respond_to do |format| format.js diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 506adceec..0836bf307 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -593,22 +593,37 @@ module ApplicationHelper Project.project_tree(projects, &block) end + # 项目版本库可见权限判断 + # 条件:1、modules中设置不可见或项目没有版本库;2、如果项目是私有或者项目版本库隐藏则必须是项目成员才可见 + def visible_repository?(project) + @result = false + unless project.enabled_modules.where("name = 'repository'").empty? || project.repositories.count == 0 + if (project.hidden_repo || !project.is_public?) + if User.current.member_of?(project) + @result = true + end + else + @result = true + end + end + return @result + end + # 判断当前用户是否为项目管理员 def is_project_manager?(user_id, project_id) @result = false mem = Member.where("user_id = ? and project_id = ?",user_id, project_id) unless mem.blank? - mem.first.roles.to_s.include?("Manager") - @result = true + @result = mem.first.roles.to_s.include?("Manager") ? true : false end return @result end - # 私有项目资源不能引用,不能设置公开私有 - # 公开项目资源可以应用,管理员和资源上传者拥有设置公开私有权限 + # 公开项目资源可以引用,admin和管理员和资源上传者拥有设置公开私有权限 def authority_pubilic_for_files(project, file) @result = false - if (is_project_manager?(User.current.id, @project.id) || file.author_id == User.current.id) && project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project" + if (is_project_manager?(User.current.id, @project.id) || file.author_id == User.current.id || User.current.admin) && + project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project" @result = true end return @result diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 071820ba3..afefc6ff1 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -206,10 +206,18 @@ class UsersService } scope = User.logged.status(status) if params[:is_search_assitant].nil? - watcher = User.watched_by(params[:user_id]) - watcher.push(params[:user_id]) + #modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件(bug:#2270) start + #say by yutao: params[:user_id]这个是指谁发起的搜索么? 如果是 这个值貌似应该从session获取 怪怪的赶脚-_-! search_by = params[:search_by] ? params[:search_by] : "0" - scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present? + if params[:name].present? + if !params[:user_id].nil? + watcher = User.watched_by(params[:user_id]) + watcher.push(params[:user_id]) + scope = scope.where("id not in (?)",watcher) + end + scope = scope.like(params[:name],search_by) + end + #modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end else teachers = searchTeacherAndAssistant(Course.find(params[:course_id])) scope = scope.where("id not in (?)",teachers.map{|t| t.user_id}).like(params[:name],search_by) if params[:name].present? diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index a18d819da..fe0e9ab97 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -28,7 +28,8 @@
+ <%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %>)