Skip to content

Commit e653ab9

Browse files
author
elasticsearchmachine
committed
[CI] Auto commit changes from spotless
1 parent cdf1785 commit e653ab9

File tree

3 files changed

+46
-53
lines changed

3 files changed

+46
-53
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege/ConfigurableClusterPrivileges.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ public static ManageRolesPrivilege parse(XContentParser parser) throws IOExcepti
563563
for (String privilege : indexPrivilege.privileges) {
564564
IndexPrivilege namedPrivilege = IndexPrivilege.getNamedOrNull(privilege);
565565

566-
// Use resolveBySelectorAccess to determine whether the passed privilege is valid.
566+
// Use resolveBySelectorAccess to determine whether the passed privilege is valid.
567567
// IllegalArgumentException is thrown here when an invalid permission is encountered.
568568
IndexPrivilege.resolveBySelectorAccess(Set.of(privilege));
569569

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/privilege/ManageRolesPrivilegesTests.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -262,26 +262,23 @@ public void testParseInvalidPrivilege() throws Exception {
262262
final XContent xContent = XContentType.JSON.xContent();
263263

264264
final String invalidJsonString = """
265-
{
266-
"manage": {
267-
"indices": [
268-
{
269-
"names": ["test-*"],
270-
"privileges": ["foobar"]
271-
}
272-
]
265+
{
266+
"manage": {
267+
"indices": [
268+
{
269+
"names": ["test-*"],
270+
"privileges": ["foobar"]
271+
}
272+
]
273+
}
273274
}
274-
}
275-
""";
275+
""";
276276

277277
try (XContentParser parser = xContent.createParser(XContentParserConfiguration.EMPTY, invalidJsonString.getBytes())) {
278278
assertThat(parser.nextToken(), equalTo(XContentParser.Token.START_OBJECT));
279279
assertThat(parser.nextToken(), equalTo(XContentParser.Token.FIELD_NAME));
280280

281-
IllegalArgumentException exception = expectThrows(
282-
IllegalArgumentException.class,
283-
() -> ManageRolesPrivilege.parse(parser)
284-
);
281+
IllegalArgumentException exception = expectThrows(IllegalArgumentException.class, () -> ManageRolesPrivilege.parse(parser));
285282

286283
assertThat(exception.getMessage(), containsString("unknown index privilege [foobar]"));
287284
}

x-pack/plugin/security/qa/security-trial/src/javaRestTest/java/org/elasticsearch/xpack/security/role/BulkPutRoleRestIT.java

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public void testPutManyValidRoles() throws Exception {
3232
"test1",
3333
new RoleDescriptor(
3434
"test1",
35-
new String[]{"all"},
36-
new RoleDescriptor.IndicesPrivileges[]{
37-
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("all").build()},
35+
new String[] { "all" },
36+
new RoleDescriptor.IndicesPrivileges[] {
37+
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("all").build() },
3838
null,
3939
null,
4040
null,
@@ -50,9 +50,9 @@ public void testPutManyValidRoles() throws Exception {
5050
"test2",
5151
new RoleDescriptor(
5252
"test2",
53-
new String[]{"all"},
54-
new RoleDescriptor.IndicesPrivileges[]{
55-
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("read").build()},
53+
new String[] { "all" },
54+
new RoleDescriptor.IndicesPrivileges[] {
55+
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("read").build() },
5656
null,
5757
null,
5858
null,
@@ -68,9 +68,9 @@ public void testPutManyValidRoles() throws Exception {
6868
"test3",
6969
new RoleDescriptor(
7070
"test3",
71-
new String[]{"all"},
72-
new RoleDescriptor.IndicesPrivileges[]{
73-
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("write").build()},
71+
new String[] { "all" },
72+
new RoleDescriptor.IndicesPrivileges[] {
73+
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("write").build() },
7474
null,
7575
null,
7676
null,
@@ -110,9 +110,9 @@ public void testPutMixedValidInvalidRoles() throws Exception {
110110
"test1",
111111
new RoleDescriptor(
112112
"test1",
113-
new String[]{"all"},
114-
new RoleDescriptor.IndicesPrivileges[]{
115-
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("all").build()},
113+
new String[] { "all" },
114+
new RoleDescriptor.IndicesPrivileges[] {
115+
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("all").build() },
116116
null,
117117
null,
118118
null,
@@ -129,9 +129,9 @@ public void testPutMixedValidInvalidRoles() throws Exception {
129129
"test3",
130130
new RoleDescriptor(
131131
"test3",
132-
new String[]{"all"},
133-
new RoleDescriptor.IndicesPrivileges[]{
134-
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("write").build()},
132+
new String[] { "all" },
133+
new RoleDescriptor.IndicesPrivileges[] {
134+
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("write").build() },
135135
null,
136136
null,
137137
null,
@@ -195,9 +195,9 @@ public void testBulkUpdates() throws Exception {
195195
"test1",
196196
new RoleDescriptor(
197197
"test1",
198-
new String[]{"all"},
199-
new RoleDescriptor.IndicesPrivileges[]{
200-
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("all").build()},
198+
new String[] { "all" },
199+
new RoleDescriptor.IndicesPrivileges[] {
200+
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("all").build() },
201201
null,
202202
null,
203203
null,
@@ -213,9 +213,9 @@ public void testBulkUpdates() throws Exception {
213213
"test2",
214214
new RoleDescriptor(
215215
"test2",
216-
new String[]{"all"},
217-
new RoleDescriptor.IndicesPrivileges[]{
218-
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("read").build()},
216+
new String[] { "all" },
217+
new RoleDescriptor.IndicesPrivileges[] {
218+
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("read").build() },
219219
null,
220220
null,
221221
null,
@@ -231,19 +231,19 @@ public void testBulkUpdates() throws Exception {
231231
"test3",
232232
new RoleDescriptor(
233233
"test3",
234-
new String[]{"all"},
235-
new RoleDescriptor.IndicesPrivileges[]{
236-
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("write").build()},
234+
new String[] { "all" },
235+
new RoleDescriptor.IndicesPrivileges[] {
236+
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("write").build() },
237237
null,
238238
null,
239239
null,
240240
null,
241241
null,
242-
new RoleDescriptor.RemoteIndicesPrivileges[]{
242+
new RoleDescriptor.RemoteIndicesPrivileges[] {
243243
RoleDescriptor.RemoteIndicesPrivileges.builder("my_cluster*", "other_cluster")
244244
.indices("logs-*")
245245
.privileges("read")
246-
.build()},
246+
.build() },
247247
null,
248248
null,
249249
null
@@ -278,9 +278,9 @@ public void testBulkUpdates() throws Exception {
278278
"test2",
279279
new RoleDescriptor(
280280
"test2",
281-
new String[]{"all"},
282-
new RoleDescriptor.IndicesPrivileges[]{
283-
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("all").build()},
281+
new String[] { "all" },
282+
new RoleDescriptor.IndicesPrivileges[] {
283+
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("all").build() },
284284
null,
285285
null,
286286
null,
@@ -296,9 +296,9 @@ public void testBulkUpdates() throws Exception {
296296
"test3",
297297
new RoleDescriptor(
298298
"test3",
299-
new String[]{"all"},
300-
new RoleDescriptor.IndicesPrivileges[]{
301-
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("all").build()},
299+
new String[] { "all" },
300+
new RoleDescriptor.IndicesPrivileges[] {
301+
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("all").build() },
302302
null,
303303
null,
304304
null,
@@ -316,9 +316,7 @@ public void testBulkUpdates() throws Exception {
316316
public void testPutRoleWithInvalidManageRolesPrivilege() throws Exception {
317317
final String badRoleName = "bad-role";
318318

319-
final ResponseException exception = expectThrows(
320-
ResponseException.class,
321-
() -> upsertRoles(String.format("""
319+
final ResponseException exception = expectThrows(ResponseException.class, () -> upsertRoles(String.format("""
322320
{
323321
"roles": {
324322
"%s": {
@@ -336,8 +334,7 @@ public void testPutRoleWithInvalidManageRolesPrivilege() throws Exception {
336334
}
337335
}
338336
}
339-
}""", badRoleName))
340-
);
337+
}""", badRoleName)));
341338

342339
assertThat(exception.getMessage(), containsString("unknown index privilege [foobar]"));
343340
assertRoleDoesNotExist(badRoleName);
@@ -351,4 +348,3 @@ private void assertRoleDoesNotExist(final String roleName) throws Exception {
351348
assertEquals(404, roleNotFound.getResponse().getStatusLine().getStatusCode());
352349
}
353350
}
354-

0 commit comments

Comments
 (0)