Commit 15c0e58a49d623a0f8747e1d7e74364324eeb79f
1 parent
c08f19f2
Exists in
master
and in
4 other branches
remove unused code related to gitolite
Showing
3 changed files
with
0 additions
and
42 deletions
Show diff stats
app/models/key.rb
| @@ -21,7 +21,6 @@ class Key < ActiveRecord::Base | @@ -21,7 +21,6 @@ class Key < ActiveRecord::Base | ||
| 21 | attr_accessible :key, :title | 21 | attr_accessible :key, :title |
| 22 | 22 | ||
| 23 | before_validation :strip_white_space | 23 | before_validation :strip_white_space |
| 24 | - before_save :set_identifier | ||
| 25 | 24 | ||
| 26 | validates :title, presence: true, length: { within: 0..255 } | 25 | validates :title, presence: true, length: { within: 0..255 } |
| 27 | validates :key, presence: true, length: { within: 0..5000 }, format: { :with => /ssh-.{3} / }, uniqueness: true | 26 | validates :key, presence: true, length: { within: 0..5000 }, format: { :with => /ssh-.{3} / }, uniqueness: true |
| @@ -48,14 +47,6 @@ class Key < ActiveRecord::Base | @@ -48,14 +47,6 @@ class Key < ActiveRecord::Base | ||
| 48 | errors.add(:key, "can't be fingerprinted") if $?.exitstatus != 0 | 47 | errors.add(:key, "can't be fingerprinted") if $?.exitstatus != 0 |
| 49 | end | 48 | end |
| 50 | 49 | ||
| 51 | - def set_identifier | ||
| 52 | - if is_deploy_key | ||
| 53 | - self.identifier = "deploy_#{Digest::MD5.hexdigest(key)}" | ||
| 54 | - else | ||
| 55 | - self.identifier = "#{user.identifier}_#{Time.now.to_i}" | ||
| 56 | - end | ||
| 57 | - end | ||
| 58 | - | ||
| 59 | def is_deploy_key | 50 | def is_deploy_key |
| 60 | !!project_id | 51 | !!project_id |
| 61 | end | 52 | end |
app/models/project_team.rb
| @@ -66,28 +66,6 @@ class ProjectTeam | @@ -66,28 +66,6 @@ class ProjectTeam | ||
| 66 | members.masters.map(&:user) | 66 | members.masters.map(&:user) |
| 67 | end | 67 | end |
| 68 | 68 | ||
| 69 | - def repository_readers | ||
| 70 | - repository_members[UsersProject::REPORTER] | ||
| 71 | - end | ||
| 72 | - | ||
| 73 | - def repository_writers | ||
| 74 | - repository_members[UsersProject::DEVELOPER] | ||
| 75 | - end | ||
| 76 | - | ||
| 77 | - def repository_masters | ||
| 78 | - repository_members[UsersProject::MASTER] | ||
| 79 | - end | ||
| 80 | - | ||
| 81 | - def repository_members | ||
| 82 | - keys = Hash.new {|h,k| h[k] = [] } | ||
| 83 | - UsersProject.select("keys.identifier, project_access"). | ||
| 84 | - joins(user: :keys).where(project_id: project.id). | ||
| 85 | - each {|row| keys[row.project_access] << [row.identifier] } | ||
| 86 | - | ||
| 87 | - keys[UsersProject::REPORTER] += project.deploy_keys.pluck(:identifier) | ||
| 88 | - keys | ||
| 89 | - end | ||
| 90 | - | ||
| 91 | def import(source_project) | 69 | def import(source_project) |
| 92 | target_project = project | 70 | target_project = project |
| 93 | 71 |
app/models/user.rb
| @@ -216,17 +216,6 @@ class User < ActiveRecord::Base | @@ -216,17 +216,6 @@ class User < ActiveRecord::Base | ||
| 216 | UsersProject.where(project_id: authorized_projects.map(&:id), user_id: self.id) | 216 | UsersProject.where(project_id: authorized_projects.map(&:id), user_id: self.id) |
| 217 | end | 217 | end |
| 218 | 218 | ||
| 219 | - # Returns a string for use as a Gitolite user identifier | ||
| 220 | - # | ||
| 221 | - # Note that Gitolite 2.x requires the following pattern for users: | ||
| 222 | - # | ||
| 223 | - # ^@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$ | ||
| 224 | - def identifier | ||
| 225 | - # Replace non-word chars with underscores, then make sure it starts with | ||
| 226 | - # valid chars | ||
| 227 | - email.gsub(/\W/, '_').gsub(/\A([\W\_])+/, '') | ||
| 228 | - end | ||
| 229 | - | ||
| 230 | def is_admin? | 219 | def is_admin? |
| 231 | admin | 220 | admin |
| 232 | end | 221 | end |