artifactory 2.5.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/CHANGELOG.md +6 -0
- data/Gemfile +9 -13
- data/README.md +10 -1
- data/Rakefile +16 -7
- data/appveyor.yml +4 -2
- data/artifactory.gemspec +14 -14
- data/lib/artifactory.rb +26 -26
- data/lib/artifactory/client.rb +25 -23
- data/lib/artifactory/configurable.rb +1 -0
- data/lib/artifactory/defaults.rb +24 -15
- data/lib/artifactory/errors.rb +2 -2
- data/lib/artifactory/resources/artifact.rb +34 -33
- data/lib/artifactory/resources/backup.rb +5 -5
- data/lib/artifactory/resources/base.rb +7 -7
- data/lib/artifactory/resources/build.rb +15 -15
- data/lib/artifactory/resources/build_component.rb +4 -4
- data/lib/artifactory/resources/group.rb +4 -4
- data/lib/artifactory/resources/layout.rb +3 -3
- data/lib/artifactory/resources/ldap_setting.rb +7 -6
- data/lib/artifactory/resources/mail_server.rb +3 -3
- data/lib/artifactory/resources/permission_target.rb +20 -20
- data/lib/artifactory/resources/plugin.rb +1 -1
- data/lib/artifactory/resources/repository.rb +20 -20
- data/lib/artifactory/resources/system.rb +6 -6
- data/lib/artifactory/resources/url_base.rb +4 -3
- data/lib/artifactory/resources/user.rb +4 -4
- data/lib/artifactory/util.rb +10 -10
- data/lib/artifactory/version.rb +1 -1
- data/spec/integration/resources/artifact_spec.rb +31 -31
- data/spec/integration/resources/backup.rb +7 -7
- data/spec/integration/resources/build_component_spec.rb +18 -18
- data/spec/integration/resources/build_spec.rb +15 -15
- data/spec/integration/resources/group_spec.rb +16 -16
- data/spec/integration/resources/layout_spec.rb +7 -7
- data/spec/integration/resources/ldap_setting_spec.rb +7 -7
- data/spec/integration/resources/mail_server_spec.rb +7 -7
- data/spec/integration/resources/permission_target_spec.rb +35 -35
- data/spec/integration/resources/repository_spec.rb +14 -14
- data/spec/integration/resources/system_spec.rb +20 -21
- data/spec/integration/resources/url_base_spec.rb +7 -7
- data/spec/integration/resources/user_spec.rb +16 -16
- data/spec/spec_helper.rb +11 -11
- data/spec/support/api_server.rb +13 -13
- data/spec/support/api_server/artifact_endpoints.rb +94 -94
- data/spec/support/api_server/build_component_endpoints.rb +18 -18
- data/spec/support/api_server/build_endpoints.rb +76 -76
- data/spec/support/api_server/group_endpoints.rb +24 -24
- data/spec/support/api_server/permission_target_endpoints.rb +24 -24
- data/spec/support/api_server/repository_endpoints.rb +82 -82
- data/spec/support/api_server/status_endpoints.rb +5 -5
- data/spec/support/api_server/system_endpoints.rb +17 -18
- data/spec/support/api_server/user_endpoints.rb +30 -30
- data/spec/unit/artifactory_spec.rb +17 -17
- data/spec/unit/client_spec.rb +43 -43
- data/spec/unit/resources/artifact_spec.rb +256 -256
- data/spec/unit/resources/backup_spec.rb +8 -8
- data/spec/unit/resources/base_spec.rb +51 -51
- data/spec/unit/resources/build_component_spec.rb +45 -45
- data/spec/unit/resources/build_spec.rb +98 -98
- data/spec/unit/resources/defaults_spec.rb +4 -4
- data/spec/unit/resources/group_spec.rb +36 -36
- data/spec/unit/resources/layout_spec.rb +8 -8
- data/spec/unit/resources/ldap_setting_spec.rb +8 -8
- data/spec/unit/resources/mail_server_spec.rb +8 -8
- data/spec/unit/resources/permission_target_spec.rb +79 -79
- data/spec/unit/resources/plugin_spec.rb +7 -7
- data/spec/unit/resources/repository_spec.rb +98 -98
- data/spec/unit/resources/system_spec.rb +30 -30
- data/spec/unit/resources/url_base_spec.rb +8 -8
- data/spec/unit/resources/user_spec.rb +40 -40
- metadata +3 -3
@@ -1,40 +1,40 @@
|
|
1
1
|
module Artifactory
|
2
2
|
module APIServer::BuildComponentEndpoints
|
3
3
|
def self.registered(app)
|
4
|
-
app.get(
|
5
|
-
content_type
|
4
|
+
app.get("/api/build") do
|
5
|
+
content_type "application/vnd.org.jfrog.build.Builds+json"
|
6
6
|
JSON.fast_generate(
|
7
|
-
|
8
|
-
|
7
|
+
"uri" => server_url.join("/api/build"),
|
8
|
+
"builds" => [
|
9
9
|
{
|
10
|
-
|
11
|
-
|
10
|
+
"uri" => "/wicket",
|
11
|
+
"lastStarted" => "2015-06-19T20:13:20.222Z",
|
12
12
|
},
|
13
13
|
{
|
14
|
-
|
15
|
-
|
16
|
-
}
|
14
|
+
"uri" => "/jackrabbit",
|
15
|
+
"lastStarted" => "2015-06-20T20:13:20.333Z",
|
16
|
+
},
|
17
17
|
]
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
21
|
-
app.post(
|
22
|
-
content_type
|
21
|
+
app.post("/api/build/rename/:name") do
|
22
|
+
content_type "text/plain"
|
23
23
|
body "Build renaming of '#{params['name']}' to '#{params['to']}' was successfully started."
|
24
24
|
end
|
25
25
|
|
26
|
-
app.delete(
|
27
|
-
content_type
|
26
|
+
app.delete("/api/build/:name") do
|
27
|
+
content_type "text/plain"
|
28
28
|
|
29
|
-
if params[
|
29
|
+
if params["deleteAll"]
|
30
30
|
body "All '#{params['name']}' builds have been deleted successfully."
|
31
|
-
elsif params[
|
31
|
+
elsif params["buildNumbers"].nil?
|
32
32
|
status 400
|
33
|
-
body
|
33
|
+
body "Please provide at least one build number to delete."
|
34
34
|
else
|
35
|
-
message = params[
|
35
|
+
message = params["buildNumbers"].split(",").map do |n|
|
36
36
|
"#{params['name']}##{n}"
|
37
|
-
end.join(
|
37
|
+
end.join(", ")
|
38
38
|
|
39
39
|
body "The following builds has been deleted successfully: #{message}."
|
40
40
|
end
|
@@ -1,61 +1,61 @@
|
|
1
1
|
module Artifactory
|
2
2
|
module APIServer::BuildEndpoints
|
3
3
|
def self.registered(app)
|
4
|
-
app.get(
|
5
|
-
content_type
|
4
|
+
app.get("/api/build/wicket") do
|
5
|
+
content_type "application/vnd.org.jfrog.build.BuildsByName+json"
|
6
6
|
JSON.fast_generate(
|
7
|
-
|
8
|
-
|
7
|
+
"uri" => server_url.join("/api/build/wicket"),
|
8
|
+
"buildsNumbers" => [
|
9
9
|
{
|
10
|
-
|
11
|
-
|
12
|
-
}
|
10
|
+
"uri" => "/51",
|
11
|
+
"started" => "2014-09-30T12:00:19.893+0300",
|
12
|
+
},
|
13
13
|
]
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
|
-
app.get(
|
18
|
-
content_type
|
17
|
+
app.get("/api/build/wicket/51") do
|
18
|
+
content_type "application/vnd.org.jfrog.build.BuildInfo+json"
|
19
19
|
JSON.fast_generate(
|
20
|
-
|
21
|
-
|
20
|
+
"uri" => server_url.join("/api/build/wicket/51"),
|
21
|
+
"buildInfo" => {
|
22
22
|
"properties" => {
|
23
23
|
"buildInfo.env.JAVA_HOME" => "/usr/jdk/latest",
|
24
24
|
},
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
"version" => "1.0.1",
|
26
|
+
"name" => "wicket",
|
27
|
+
"number" => "51",
|
28
|
+
"type" => "MAVEN",
|
29
|
+
"buildAgent" => {
|
30
30
|
"name" => "Maven",
|
31
|
-
"version" => "3.0.5"
|
31
|
+
"version" => "3.0.5",
|
32
32
|
},
|
33
|
-
|
33
|
+
"agent" => {
|
34
34
|
"name" => "Jenkins",
|
35
|
-
"version" => "1.565.2"
|
35
|
+
"version" => "1.565.2",
|
36
36
|
},
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
"started" => "2014-09-30T12:00:19.893+0300",
|
38
|
+
"durationMillis" => 8926,
|
39
|
+
"artifactoryPrincipal" => "admin",
|
40
|
+
"url" => "http://localhost:8080/job/Maven2-3/9/",
|
41
|
+
"vcsRevision" => "83049487ecc61bef3dce798838e7a9457e174a5a",
|
42
|
+
"vcsUrl" => "https://github.com/aseftel/project-examples",
|
43
|
+
"licenseControl" => {
|
44
44
|
"runChecks" => false,
|
45
45
|
"includePublishedArtifacts" => false,
|
46
46
|
"autoDiscover" => true,
|
47
47
|
"scopesList" => "",
|
48
|
-
"licenseViolationsRecipientsList" => ""
|
48
|
+
"licenseViolationsRecipientsList" => "",
|
49
49
|
},
|
50
|
-
|
50
|
+
"buildRetention" => {
|
51
51
|
"count" => -1,
|
52
52
|
"deleteBuildArtifacts" => true,
|
53
|
-
"buildNumbersNotToBeDiscarded" => []
|
53
|
+
"buildNumbersNotToBeDiscarded" => [],
|
54
54
|
},
|
55
|
-
|
55
|
+
"modules" => [
|
56
56
|
{
|
57
57
|
"properties" => {
|
58
|
-
"project.build.sourceEncoding" => "UTF-8"
|
58
|
+
"project.build.sourceEncoding" => "UTF-8",
|
59
59
|
},
|
60
60
|
"id" => "org.jfrog.test:multi:2.19-SNAPSHOT",
|
61
61
|
"artifacts" => [
|
@@ -63,107 +63,107 @@ module Artifactory
|
|
63
63
|
"type" => "pom",
|
64
64
|
"sha1" => "045b66ebbf8504002b626f592d087612aca36582",
|
65
65
|
"md5" => "c25542a353dab1089cd186465dc47a68",
|
66
|
-
"name" => "multi-2.19-SNAPSHOT.pom"
|
67
|
-
}
|
68
|
-
]
|
66
|
+
"name" => "multi-2.19-SNAPSHOT.pom",
|
67
|
+
},
|
68
|
+
],
|
69
69
|
},
|
70
70
|
{
|
71
71
|
"properties" => {
|
72
|
-
"project.build.sourceEncoding" => "UTF-8"
|
72
|
+
"project.build.sourceEncoding" => "UTF-8",
|
73
73
|
},
|
74
74
|
"id" => "org.jfrog.test:multi1:2.19-SNAPSHOT",
|
75
|
-
"artifacts"=> [
|
75
|
+
"artifacts" => [
|
76
76
|
{
|
77
77
|
"type" => "jar",
|
78
78
|
"sha1" => "f4c5c9cb3091011ec2a895b3dedd7f10d847361c",
|
79
79
|
"md5" => "d1fd850a3582efba41092c624e0b46b8",
|
80
|
-
"name" => "multi1-2.19-SNAPSHOT.jar"
|
80
|
+
"name" => "multi1-2.19-SNAPSHOT.jar",
|
81
81
|
},
|
82
82
|
{
|
83
83
|
"type" => "pom",
|
84
84
|
"sha1" => "2ddbf9824676f548d637726d3bcbb494ba823090",
|
85
85
|
"md5" => "a64aa7f305f63a85e63a0155ff0fb404",
|
86
|
-
"name" => "multi1-2.19-SNAPSHOT.pom"
|
86
|
+
"name" => "multi1-2.19-SNAPSHOT.pom",
|
87
87
|
},
|
88
88
|
{
|
89
89
|
"type" => "jar",
|
90
90
|
"sha1" => "6fdd143a44cea3a2636660c5c266c95c27e50abc",
|
91
91
|
"md5" => "12a1e438f4bef8c4b740fe848a1704a4",
|
92
92
|
"id" => "org.slf4j:slf4j-simple:1.4.3",
|
93
|
-
"scopes" => [ "compile" ]
|
93
|
+
"scopes" => [ "compile" ],
|
94
94
|
},
|
95
95
|
{
|
96
96
|
"type" => "jar",
|
97
97
|
"sha1" => "496e91f7df8a0417e00cecdba840cdf0e5f2472c",
|
98
98
|
"md5" => "76a412a37c9d18659d2dacccdb1c24ff",
|
99
99
|
"id" => "org.jenkins-ci.lib:dry-run-lib:0.1",
|
100
|
-
"scopes" => [ "compile" ]
|
101
|
-
}
|
102
|
-
]
|
100
|
+
"scopes" => [ "compile" ],
|
101
|
+
},
|
102
|
+
],
|
103
103
|
},
|
104
104
|
{
|
105
105
|
"properties" => {
|
106
106
|
"daversion" => "2.19-SNAPSHOT",
|
107
|
-
"project.build.sourceEncoding"=>"UTF-8"
|
107
|
+
"project.build.sourceEncoding" => "UTF-8",
|
108
108
|
},
|
109
109
|
"id" => "org.jfrog.test:multi2:2.19-SNAPSHOT",
|
110
110
|
"artifacts" => [
|
111
111
|
{
|
112
112
|
"type" => "txt",
|
113
|
-
"name" => "multi2-2.19-SNAPSHOT.txt"
|
113
|
+
"name" => "multi2-2.19-SNAPSHOT.txt",
|
114
114
|
},
|
115
115
|
{
|
116
116
|
"type" => "java-source-jar",
|
117
117
|
"sha1" => "49108b0c7db5fdb4efe3c29a5a9f54e806aecb62",
|
118
118
|
"md5" => "0e2c5473cf2a9b694afb4a2e8da34b53",
|
119
|
-
"name" => "multi2-2.19-SNAPSHOT-sources.jar"},
|
119
|
+
"name" => "multi2-2.19-SNAPSHOT-sources.jar" },
|
120
120
|
{
|
121
121
|
"type" => "jar",
|
122
122
|
"sha1" => "476e89d290ae36dabb38ff22f75f264ae019d542",
|
123
123
|
"md5" => "fa9b3df58ac040fffcff9310f261be80",
|
124
|
-
"name" => "multi2-2.19-SNAPSHOT.jar"
|
124
|
+
"name" => "multi2-2.19-SNAPSHOT.jar",
|
125
125
|
},
|
126
126
|
{
|
127
127
|
"type" => "pom",
|
128
128
|
"sha1" => "b719b90364e5ae38cda358072f61f821bdae5d5d",
|
129
129
|
"md5" => "8d5060005235d75907baca4490cf60bf",
|
130
|
-
"name" => "multi2-2.19-SNAPSHOT.pom"
|
131
|
-
}
|
130
|
+
"name" => "multi2-2.19-SNAPSHOT.pom",
|
131
|
+
},
|
132
132
|
],
|
133
|
-
"dependencies"=> [
|
133
|
+
"dependencies" => [
|
134
134
|
{
|
135
135
|
"type" => "jar",
|
136
136
|
"sha1" => "19d4e90b43059058f6e056f794f0ea4030d60b86",
|
137
137
|
"md5" => "dcd95bcb84b09897b2b66d4684c040da",
|
138
138
|
"id" => "xpp3:xpp3_min:1.1.4c",
|
139
|
-
"scopes" => [ "provided" ]
|
139
|
+
"scopes" => [ "provided" ],
|
140
140
|
},
|
141
141
|
{
|
142
142
|
"type" => "jar",
|
143
143
|
"sha1" => "e2d866af5518e81282838301b49a1bd2452619d3",
|
144
144
|
"md5" => "e9e4b59c69305ba3698dd61c5dfc4fc8",
|
145
145
|
"id" => "org.jvnet.hudson.plugins:perforce:1.3.7",
|
146
|
-
"scopes" => [ "compile" ]
|
146
|
+
"scopes" => [ "compile" ],
|
147
147
|
},
|
148
148
|
{
|
149
149
|
"type" => "jar",
|
150
150
|
"sha1" => "6fdd143a44cea3a2636660c5c266c95c27e50abc",
|
151
151
|
"md5" => "12a1e438f4bef8c4b740fe848a1704a4",
|
152
152
|
"id" => "org.slf4j:slf4j-simple:1.4.3",
|
153
|
-
"scopes" => [ "compile" ]
|
153
|
+
"scopes" => [ "compile" ],
|
154
154
|
},
|
155
155
|
{
|
156
156
|
"type" => "jar",
|
157
157
|
"sha1" => "496e91f7df8a0417e00cecdba840cdf0e5f2472c",
|
158
158
|
"md5" => "76a412a37c9d18659d2dacccdb1c24ff",
|
159
159
|
"id" => "org.jenkins-ci.lib:dry-run-lib:0.1",
|
160
|
-
"scopes" => [ "compile" ]
|
161
|
-
}
|
162
|
-
]
|
160
|
+
"scopes" => [ "compile" ],
|
161
|
+
},
|
162
|
+
],
|
163
163
|
},
|
164
164
|
{
|
165
165
|
"properties" => {
|
166
|
-
"project.build.sourceEncoding" => "UTF-8"
|
166
|
+
"project.build.sourceEncoding" => "UTF-8",
|
167
167
|
},
|
168
168
|
"id" => "org.jfrog.test:multi3:2.19-SNAPSHOT",
|
169
169
|
"artifacts" => [
|
@@ -171,58 +171,58 @@ module Artifactory
|
|
171
171
|
"type" => "java-source-jar",
|
172
172
|
"sha1" => "3cd104785167ac37ef999431f308ffef10810348",
|
173
173
|
"md5" => "c683276f8dda97078ae8eb5e26bb3ee5",
|
174
|
-
"name" => "multi3-2.19-SNAPSHOT-sources.jar"
|
174
|
+
"name" => "multi3-2.19-SNAPSHOT-sources.jar",
|
175
175
|
},
|
176
176
|
{
|
177
177
|
"type" => "war",
|
178
178
|
"sha1" => "34aeebeb805b23922d9d05507404533518cf81e4",
|
179
179
|
"md5" => "55af06a2175cfb23cc6dc3931475b57c",
|
180
|
-
"name" => "multi3-2.19-SNAPSHOT.war"
|
180
|
+
"name" => "multi3-2.19-SNAPSHOT.war",
|
181
181
|
},
|
182
182
|
{
|
183
183
|
"type" => "jar",
|
184
184
|
"sha1" => "496e91f7df8a0417e00cecdba840cdf0e5f2472c",
|
185
185
|
"md5" => "76a412a37c9d18659d2dacccdb1c24ff",
|
186
186
|
"id" => "org.jenkins-ci.lib:dry-run-lib:0.1",
|
187
|
-
"scopes" => [ "compile" ]
|
187
|
+
"scopes" => [ "compile" ],
|
188
188
|
},
|
189
189
|
{
|
190
190
|
"type" => "jar",
|
191
191
|
"sha1" => "7e9978fdb754bce5fcd5161133e7734ecb683036",
|
192
192
|
"md5" => "7df83e09e41d742cc5fb20d16b80729c",
|
193
193
|
"id" => "hsqldb:hsqldb:1.8.0.10",
|
194
|
-
"scopes" => [ "runtime" ]
|
195
|
-
}
|
196
|
-
]
|
197
|
-
}
|
194
|
+
"scopes" => [ "runtime" ],
|
195
|
+
},
|
196
|
+
],
|
197
|
+
},
|
198
198
|
],
|
199
|
-
|
199
|
+
"governance" => {
|
200
200
|
"blackDuckProperties" => {
|
201
201
|
"runChecks" => false,
|
202
202
|
"includePublishedArtifacts" => false,
|
203
203
|
"autoCreateMissingComponentRequests" => false,
|
204
|
-
"autoDiscardStaleComponentRequests" => false
|
205
|
-
}
|
206
|
-
}
|
204
|
+
"autoDiscardStaleComponentRequests" => false,
|
205
|
+
},
|
206
|
+
},
|
207
207
|
}
|
208
208
|
)
|
209
209
|
end
|
210
210
|
|
211
|
-
app.put(
|
211
|
+
app.put("/api/build") do
|
212
212
|
status 204
|
213
|
-
body
|
213
|
+
body ""
|
214
214
|
end
|
215
215
|
|
216
|
-
app.post(
|
217
|
-
content_type
|
216
|
+
app.post("/api/build/promote/wicket/51") do
|
217
|
+
content_type "application/vnd.org.jfrog.artifactory.build.PromotionResult+json"
|
218
218
|
|
219
219
|
JSON.fast_generate(
|
220
|
-
|
221
|
-
|
220
|
+
"uri" => server_url.join("/api/build/wicket"),
|
221
|
+
"buildsNumbers" => [
|
222
222
|
{
|
223
|
-
|
224
|
-
|
225
|
-
}
|
223
|
+
"uri" => "/51",
|
224
|
+
"started" => "2014-09-30T12:00:19.893+0300",
|
225
|
+
},
|
226
226
|
]
|
227
227
|
)
|
228
228
|
end
|
@@ -1,51 +1,51 @@
|
|
1
1
|
module Artifactory
|
2
2
|
module APIServer::GroupEndpoints
|
3
3
|
def self.registered(app)
|
4
|
-
app.get(
|
5
|
-
content_type
|
4
|
+
app.get("/api/security/groups") do
|
5
|
+
content_type "application/vnd.org.jfrog.artifactory.security.Groups+json"
|
6
6
|
JSON.fast_generate([
|
7
7
|
{
|
8
|
-
|
9
|
-
|
8
|
+
"name" => "readers",
|
9
|
+
"uri" => server_url.join("/api/security/groups/readers"),
|
10
10
|
},
|
11
11
|
{
|
12
|
-
|
13
|
-
|
14
|
-
}
|
12
|
+
"name" => "tech-leads",
|
13
|
+
"uri" => server_url.join("/api/security/groups/tech-leads"),
|
14
|
+
},
|
15
15
|
])
|
16
16
|
end
|
17
17
|
|
18
|
-
app.get(
|
19
|
-
content_type
|
18
|
+
app.get("/api/security/groups/readers") do
|
19
|
+
content_type "application/vnd.org.jfrog.artifactory.security.Group+json"
|
20
20
|
JSON.fast_generate(
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
"name" => "readers",
|
22
|
+
"description" => "This list of read-only users",
|
23
|
+
"autoJoin" => true,
|
24
|
+
"realm" => "artifactory",
|
25
|
+
"realmAttributes" => nil
|
26
26
|
)
|
27
27
|
end
|
28
28
|
|
29
|
-
app.get(
|
30
|
-
content_type
|
29
|
+
app.get("/api/security/groups/tech-leads") do
|
30
|
+
content_type "application/vnd.org.jfrog.artifactory.security.Group+json"
|
31
31
|
JSON.fast_generate(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
"name" => "tech-leads",
|
33
|
+
"description" => "This development leads group",
|
34
|
+
"autoJoin" => false,
|
35
|
+
"realm" => "artifactory",
|
36
|
+
"realmAttributes" => nil
|
37
37
|
)
|
38
38
|
end
|
39
39
|
|
40
|
-
app.put(
|
41
|
-
return 415 unless request.content_type ==
|
40
|
+
app.put("/api/security/groups/:name") do
|
41
|
+
return 415 unless request.content_type == "application/vnd.org.jfrog.artifactory.security.Group+json"
|
42
42
|
|
43
43
|
# Attempt to parse the response; if this succeeds, all is well...
|
44
44
|
JSON.parse(request.body.read)
|
45
45
|
nil
|
46
46
|
end
|
47
47
|
|
48
|
-
app.delete(
|
48
|
+
app.delete("/api/security/groups/:name") do
|
49
49
|
nil
|
50
50
|
end
|
51
51
|
end
|
@@ -1,51 +1,51 @@
|
|
1
1
|
module Artifactory
|
2
2
|
module APIServer::PermissionTargetEndpoints
|
3
3
|
def self.registered(app)
|
4
|
-
app.get(
|
5
|
-
content_type
|
4
|
+
app.get("/api/security/permissions") do
|
5
|
+
content_type "application/vnd.org.jfrog.artifactory.security.PermissionTargets+json"
|
6
6
|
JSON.fast_generate([
|
7
7
|
{
|
8
|
-
|
9
|
-
|
8
|
+
"name" => "Anything",
|
9
|
+
"uri" => server_url.join("/api/security/permissions/Anything"),
|
10
10
|
},
|
11
11
|
{
|
12
|
-
|
13
|
-
|
14
|
-
}
|
12
|
+
"name" => "Any Remote",
|
13
|
+
"uri" => server_url.join("/api/security/permissions/Any%20Remote"),
|
14
|
+
},
|
15
15
|
])
|
16
16
|
end
|
17
17
|
|
18
|
-
app.get(
|
19
|
-
content_type
|
18
|
+
app.get("/api/security/permissions/Any%20Remote") do
|
19
|
+
content_type "application/vnd.org.jfrog.artifactory.security.PermissionTargets+json"
|
20
20
|
JSON.fast_generate(
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
"name" => "Any Remote",
|
22
|
+
"includes_pattern" => nil,
|
23
|
+
"excludes_pattern" => "",
|
24
|
+
"repositories" => ["ANY REMOTE"],
|
25
|
+
"principals" => { "users" => { "anonymous" => %w{w r} }, "groups" => nil }
|
26
26
|
)
|
27
27
|
end
|
28
28
|
|
29
|
-
app.get(
|
30
|
-
content_type
|
29
|
+
app.get("/api/security/permissions/Anything") do
|
30
|
+
content_type "application/vnd.org.jfrog.artifactory.security.PermissionTargets+json"
|
31
31
|
JSON.fast_generate(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
"name" => "Anything",
|
33
|
+
"includes_pattern" => nil,
|
34
|
+
"excludes_pattern" => "",
|
35
|
+
"repositories" => ["ANY"],
|
36
|
+
"principals" => { "users" => { "anonymous" => ["r"] }, "groups" => { "readers" => %w{r m} } }
|
37
37
|
)
|
38
38
|
end
|
39
39
|
|
40
|
-
app.put(
|
41
|
-
return 415 unless request.content_type ==
|
40
|
+
app.put("/api/security/permissions/:name") do
|
41
|
+
return 415 unless request.content_type == "application/vnd.org.jfrog.artifactory.security.PermissionTarget+json"
|
42
42
|
|
43
43
|
# Attempt to parse the response; if this succeeds, all is well...
|
44
44
|
JSON.parse(request.body.read)
|
45
45
|
nil
|
46
46
|
end
|
47
47
|
|
48
|
-
app.delete(
|
48
|
+
app.delete("/api/security/permissions/:name") do
|
49
49
|
nil
|
50
50
|
end
|
51
51
|
end
|