get-user-privileges.asciidoc 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. [role="xpack"]
  2. [[security-api-get-user-privileges]]
  3. === Get user privileges API
  4. ++++
  5. <titleabbrev>Get user privileges</titleabbrev>
  6. ++++
  7. .New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-security[Security APIs].
  11. --
  12. Retrieves the <<security-privileges,security privileges>> for the logged in
  13. user.
  14. [[security-api-get-user-privileges-request]]
  15. ==== {api-request-title}
  16. `GET /_security/user/_privileges`
  17. [[security-api-get-user-privileges-prereqs]]
  18. ==== {api-prereq-title}
  19. * All users can use this API, but only to determine their own privileges. To
  20. check the privileges of other users, you must use the run as feature. For
  21. more information, see <<run-as-privilege>>.
  22. [[security-api-get-user-privileges-desc]]
  23. ==== {api-description-title}
  24. To check whether a user has a specific list of privileges, use the
  25. <<security-api-has-privileges,has privileges API>>.
  26. [[security-api-get-user-privileges-example]]
  27. ==== {api-examples-title}
  28. [source,console]
  29. --------------------------------------------------
  30. GET /_security/user/_privileges
  31. --------------------------------------------------
  32. [source,console-result]
  33. --------------------------------------------------
  34. {
  35. "cluster" : [
  36. "all"
  37. ],
  38. "global" : [ ],
  39. "indices" : [
  40. {
  41. "names" : [
  42. "*"
  43. ],
  44. "privileges" : [
  45. "all"
  46. ],
  47. "allow_restricted_indices" : true
  48. }
  49. ],
  50. "applications" : [
  51. {
  52. "application" : "*",
  53. "privileges" : [
  54. "*"
  55. ],
  56. "resources" : [
  57. "*"
  58. ]
  59. }
  60. ],
  61. "run_as" : [
  62. "*"
  63. ]
  64. }
  65. --------------------------------------------------
  66. // TESTRESPONSE[s/: false/: true/]