github.com/qichengzx/mattermost-server@v4.5.1-0.20180604164826-2c75247c97d0+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 16 // No permission check required. 17 18 if policy, err := c.App.GetDataRetentionPolicy(); err != nil { 19 c.Err = err 20 return 21 } else { 22 w.Write([]byte(policy.ToJson())) 23 } 24 }