A simple change baselined off the 3.0.3 version of gitlabhq to allow Reporter level access for all logged in users for all repositories.
Allow searching across all projects, not just projects where the current user is a team member.
diff --git a/app/contexts/search_context.rb b/app/contexts/search_context.rb
index 6e5e8c5..c4bc1b4 100644
--- a/app/contexts/search_context.rb
+++ b/app/contexts/search_context.rb
@@ -10,7 +10,7 @@ class SearchContext
return result unless query.present?
- result[:projects] = Project.where(id: project_ids).search(query).limit(10)
+ result[:projects] = Project.search(query).limit(10)
result[:merge_requests] = MergeRequest.where(project_id: project_ids).search(query).limit(10)
result[:issues] = Issue.where(project_id: project_ids).search(query).limit(10)
result
Prevent 404'ing repos that the current user is not a team member of.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index b597795..a672087 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -54,7 +54,7 @@ class ApplicationController < ActionController::Base
end
def project
- @project ||= current_user.projects.find_by_code(params[:project_id] || params[:id])
+ @project ||= Project.find_by_code(params[:project_id] || params[:id])
@project || render_404
end
Allow reporter level access for all users for all repos. You can tweak if you'd prefer guest level, or developer level.
diff --git a/app/roles/authority.rb b/app/roles/authority.rb
index e0796d5..32b7425 100644
--- a/app/roles/authority.rb
+++ b/app/roles/authority.rb
@@ -37,15 +37,15 @@ module Authority
end
def allow_read_for?(user)
- !users_projects.where(user_id: user.id).empty?
+ true
end
def guest_access_for?(user)
- !users_projects.where(user_id: user.id).empty?
+ true
end
def report_access_for?(user)
- !users_projects.where(user_id: user.id, project_access: [UsersProject::REPORTER, UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
+ true
end
def dev_access_for?(user)
If you want to also allow cloning of all repos, edit /home/git/.gitolite.rc
to uncomment the following flag and set it to 1.
$GL_ALL_READ_ALL = 1;