remove unused code related to gitolite
This commit is contained in:
parent
c08f19f275
commit
15c0e58a49
3 changed files with 0 additions and 42 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue