diff --git a/app/models/key.rb b/app/models/key.rb index edb0bcd6..53eee511 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -21,7 +21,6 @@ class Key < ActiveRecord::Base attr_accessible :key, :title before_validation :strip_white_space - before_save :set_identifier validates :title, presence: true, length: { within: 0..255 } validates :key, presence: true, length: { within: 0..5000 }, format: { :with => /ssh-.{3} / }, uniqueness: true @@ -48,14 +47,6 @@ class Key < ActiveRecord::Base errors.add(:key, "can't be fingerprinted") if $?.exitstatus != 0 end - def set_identifier - if is_deploy_key - self.identifier = "deploy_#{Digest::MD5.hexdigest(key)}" - else - self.identifier = "#{user.identifier}_#{Time.now.to_i}" - end - end - def is_deploy_key !!project_id end diff --git a/app/models/project_team.rb b/app/models/project_team.rb index c2cf83c0..f3e5c0e5 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -66,28 +66,6 @@ class ProjectTeam members.masters.map(&:user) end - def repository_readers - repository_members[UsersProject::REPORTER] - end - - def repository_writers - repository_members[UsersProject::DEVELOPER] - end - - def repository_masters - repository_members[UsersProject::MASTER] - end - - def repository_members - keys = Hash.new {|h,k| h[k] = [] } - UsersProject.select("keys.identifier, project_access"). - joins(user: :keys).where(project_id: project.id). - each {|row| keys[row.project_access] << [row.identifier] } - - keys[UsersProject::REPORTER] += project.deploy_keys.pluck(:identifier) - keys - end - def import(source_project) target_project = project diff --git a/app/models/user.rb b/app/models/user.rb index b72349f8..cd0754d7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -216,17 +216,6 @@ class User < ActiveRecord::Base UsersProject.where(project_id: authorized_projects.map(&:id), user_id: self.id) end - # Returns a string for use as a Gitolite user identifier - # - # Note that Gitolite 2.x requires the following pattern for users: - # - # ^@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$ - def identifier - # Replace non-word chars with underscores, then make sure it starts with - # valid chars - email.gsub(/\W/, '_').gsub(/\A([\W\_])+/, '') - end - def is_admin? admin end