github.com/kongr45gpen/mattermost-server@v5.11.1+incompatible/api4/data_retention.go (about)

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