get-user-privileges.asciidoc 1.5 KB

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