@@ -48,32 +48,6 @@ def to_s
48
48
end
49
49
50
50
51
- def set_identifier
52
- self . identifier ||=
53
- begin
54
- my_time = Time . now
55
- time_tag = "#{ my_time . to_i . to_s } _#{ my_time . usec . to_s } "
56
- key_count = GitolitePublicKey . by_user ( self . user ) . deploy_key . length + 1
57
- case key_type
58
- when KEY_TYPE_USER
59
- # add "redmine_" as a prefix to the username, and then the current date
60
- # this helps ensure uniqueness of each key identifier
61
- #
62
- # also, it ensures that it is very, very unlikely to conflict with any
63
- # existing key name if gitolite config is also being edited manually
64
- "#{ self . user . gitolite_identifier } " << "@redmine_" << "#{ time_tag } " . gsub ( /[^0-9a-zA-Z\- ]/ , '_' )
65
- when KEY_TYPE_DEPLOY
66
- # add "redmine_deploy_key_" as a prefix, and then the current date
67
- # to help ensure uniqueness of each key identifier
68
- # "redmine_#{DEPLOY_PSEUDO_USER}_#{time_tag}".gsub(/[^0-9a-zA-Z\-]/, '_') << "@redmine_" << "#{time_tag}".gsub(/[^0-9a-zA-Z\-]/, '_')
69
- "#{ self . user . gitolite_identifier } _#{ DEPLOY_PSEUDO_USER } _#{ key_count } " . gsub ( /[^0-9a-zA-Z\- ]/ , '_' ) << "@redmine_" << "#{ time_tag } " . gsub ( /[^0-9a-zA-Z\- ]/ , '_' )
70
- else
71
- nil
72
- end
73
- end
74
- end
75
-
76
-
77
51
# Make sure that current identifier is consistent with current user login.
78
52
# This method explicitly overrides the static nature of the identifier
79
53
def reset_identifier
@@ -246,4 +220,30 @@ def key_uniqueness
246
220
return true
247
221
end
248
222
223
+
224
+ def set_identifier
225
+ self . identifier ||=
226
+ begin
227
+ my_time = Time . now
228
+ time_tag = "#{ my_time . to_i . to_s } _#{ my_time . usec . to_s } "
229
+ key_count = GitolitePublicKey . by_user ( self . user ) . deploy_key . length + 1
230
+ case key_type
231
+ when KEY_TYPE_USER
232
+ # add "redmine_" as a prefix to the username, and then the current date
233
+ # this helps ensure uniqueness of each key identifier
234
+ #
235
+ # also, it ensures that it is very, very unlikely to conflict with any
236
+ # existing key name if gitolite config is also being edited manually
237
+ "#{ self . user . gitolite_identifier } " << "@redmine_" << "#{ time_tag } " . gsub ( /[^0-9a-zA-Z\- ]/ , '_' )
238
+ when KEY_TYPE_DEPLOY
239
+ # add "redmine_deploy_key_" as a prefix, and then the current date
240
+ # to help ensure uniqueness of each key identifier
241
+ # "redmine_#{DEPLOY_PSEUDO_USER}_#{time_tag}".gsub(/[^0-9a-zA-Z\-]/, '_') << "@redmine_" << "#{time_tag}".gsub(/[^0-9a-zA-Z\-]/, '_')
242
+ "#{ self . user . gitolite_identifier } _#{ DEPLOY_PSEUDO_USER } _#{ key_count } " . gsub ( /[^0-9a-zA-Z\- ]/ , '_' ) << "@redmine_" << "#{ time_tag } " . gsub ( /[^0-9a-zA-Z\- ]/ , '_' )
243
+ else
244
+ nil
245
+ end
246
+ end
247
+ end
248
+
249
249
end
0 commit comments