File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed
docs/reference/rest-api/security
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 1111For the most up-to-date API details, refer to {api-es}/group/endpoint-security[Security APIs].
1212--
1313
14- Retrieves the <<security-privileges,security privileges>> for the logged in
14+ Retrieves the <<security-privileges,security privileges>> for the logged in
1515user.
1616
1717[[security-api-get-user-privileges-request]]
2222[[security-api-get-user-privileges-prereqs]]
2323==== {api-prereq-title}
2424
25- * All users can use this API, but only to determine their own privileges. To
25+ * All users can use this API, but only to determine their own privileges. To
2626check the privileges of other users, you must use the run as feature. For
2727more information, see <<run-as-privilege>>.
2828
@@ -57,6 +57,15 @@ GET /_security/user/_privileges
5757 "all"
5858 ],
5959 "allow_restricted_indices" : true
60+ },
61+ {
62+ "names" : [
63+ "*::failures"
64+ ],
65+ "privileges" : [
66+ "all"
67+ ],
68+ "allow_restricted_indices" : true
6069 }
6170 ],
6271 "applications" : [
Original file line number Diff line number Diff line change @@ -433,6 +433,19 @@ static SimpleRole buildFromRoleDescriptor(
433433 );
434434
435435 for (RoleDescriptor .IndicesPrivileges indexPrivilege : roleDescriptor .getIndicesPrivileges ()) {
436+ if (Arrays .asList (indexPrivilege .getIndices ()).contains ("*" )) {
437+ builder .add (
438+ fieldPermissionsCache .getFieldPermissions (
439+ new FieldPermissionsDefinition (indexPrivilege .getGrantedFields (), indexPrivilege .getDeniedFields ())
440+ ),
441+ indexPrivilege .getQuery () == null ? null : Collections .singleton (indexPrivilege .getQuery ()),
442+ IndexPrivilege .get (Sets .newHashSet (indexPrivilege .getPrivileges ())),
443+ indexPrivilege .allowRestrictedIndices (),
444+ // TODO properly handle this
445+ true ,
446+ indexPrivilege .getIndices ()
447+ );
448+ }
436449 builder .add (
437450 fieldPermissionsCache .getFieldPermissions (
438451 new FieldPermissionsDefinition (indexPrivilege .getGrantedFields (), indexPrivilege .getDeniedFields ())
@@ -441,7 +454,7 @@ static SimpleRole buildFromRoleDescriptor(
441454 IndexPrivilege .get (Sets .newHashSet (indexPrivilege .getPrivileges ())),
442455 indexPrivilege .allowRestrictedIndices (),
443456 // TODO properly handle this
444- Arrays . asList ( indexPrivilege . getIndices ()). contains ( "*" ) ,
457+ false ,
445458 indexPrivilege .getIndices ()
446459 );
447460 }
You can’t perform that action at this time.
0 commit comments