data_retention.go 521 B

12345678910111213141516171819202122232425
  1. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
  2. // See LICENSE.txt for license information.
  3. package api4
  4. import (
  5. "net/http"
  6. )
  7. func (api *API) InitDataRetention() {
  8. api.BaseRoutes.DataRetention.Handle("/policy", api.ApiSessionRequired(getPolicy)).Methods("GET")
  9. }
  10. func getPolicy(c *Context, w http.ResponseWriter, r *http.Request) {
  11. // No permission check required.
  12. policy, err := c.App.GetDataRetentionPolicy()
  13. if err != nil {
  14. c.Err = err
  15. return
  16. }
  17. w.Write([]byte(policy.ToJson()))
  18. }