@@ -3,37 +3,54 @@ module Users
3
3
extend ActiveSupport ::Concern
4
4
5
5
def gitolite_users
6
- data = { }
7
-
8
6
if project . active?
9
- # Add project users
10
- data [ :rewind_users ] = rewind_users
11
- data [ :write_users ] = write_users
12
- data [ :read_users ] = read_users
13
- data [ :developer_team ] = developer_team
14
- data [ :all_read ] = all_read
15
-
16
- # Add Řepository Deployment keys
17
- deployment_credentials . active . each do |cred |
18
- if cred . perm == 'RW+'
19
- data [ :rewind_users ] << cred . gitolite_public_key . owner
20
- elsif cred . perm == 'R'
21
- data [ :read_users ] << cred . gitolite_public_key . owner
22
- end
23
- end
24
-
25
- # Add other users
26
- data [ :read_users ] << 'DUMMY_REDMINE_KEY' if read_users . empty? && write_users . empty? && rewind_users . empty?
27
- data [ :read_users ] << 'gitweb' if git_web_available?
28
- data [ :read_users ] << 'daemon' if git_daemon_available?
29
-
7
+ users_for_active_project
30
8
elsif project . archived?
31
- data [ :read_users ] = [ 'REDMINE_ARCHIVED_PROJECT' ]
9
+ users_for_archived_project
32
10
else
33
- data [ :read_users ] = all_read
34
- data [ :read_users ] << 'REDMINE_CLOSED_PROJECT'
11
+ users_for_closed_project
12
+ end
13
+ end
14
+
15
+
16
+ def users_for_active_project
17
+ data = { }
18
+ data [ :rewind_users ] = rewind_users
19
+ data [ :write_users ] = write_users
20
+ data [ :read_users ] = read_users
21
+ data [ :developer_team ] = developer_team
22
+ data [ :all_read ] = all_read
23
+
24
+ # Add Řepository Deployment keys
25
+ deployment_credentials . active . each do |cred |
26
+ if cred . perm == 'RW+'
27
+ data [ :rewind_users ] << cred . gitolite_public_key . owner
28
+ elsif cred . perm == 'R'
29
+ data [ :read_users ] << cred . gitolite_public_key . owner
30
+ end
35
31
end
36
32
33
+ # Add other users
34
+ data [ :read_users ] << 'DUMMY_REDMINE_KEY' if read_users . empty? && write_users . empty? && rewind_users . empty?
35
+ data [ :read_users ] << 'gitweb' if git_web_available?
36
+ data [ :read_users ] << 'daemon' if git_daemon_available?
37
+
38
+ # Return users
39
+ data
40
+ end
41
+
42
+
43
+ def users_for_archived_project
44
+ data = { }
45
+ data [ :read_users ] = [ 'REDMINE_ARCHIVED_PROJECT' ]
46
+ data
47
+ end
48
+
49
+
50
+ def users_for_closed_project
51
+ data = { }
52
+ data [ :read_users ] = all_read
53
+ data [ :read_users ] << 'REDMINE_CLOSED_PROJECT'
37
54
data
38
55
end
39
56
0 commit comments