Remove deprecated function (#27605)
* make /ancillary a post * remove get from client, fix tests * remove GET for retrieving ancillary permissions * Update permissions.yaml * Update permissions.yaml --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
be94c47607
Коммит
db138fd23a
@@ -6,35 +6,14 @@ package api4
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
)
|
||||
|
||||
func (api *API) InitPermissions() {
|
||||
// to be deprecated - kept for backward compatibility
|
||||
api.BaseRoutes.Permissions.Handle("/ancillary", api.APISessionRequired(appendAncillaryPermissions)).Methods(http.MethodGet)
|
||||
api.BaseRoutes.Permissions.Handle("/ancillary", api.APISessionRequired(appendAncillaryPermissionsPost)).Methods(http.MethodPost)
|
||||
}
|
||||
|
||||
func appendAncillaryPermissions(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
keys, ok := r.URL.Query()["subsection_permissions"]
|
||||
|
||||
if !ok || len(keys[0]) < 1 {
|
||||
c.SetInvalidURLParam("subsection_permissions")
|
||||
return
|
||||
}
|
||||
|
||||
permissions := strings.Split(keys[0], ",")
|
||||
b, err := json.Marshal(model.AddAncillaryPermissions(permissions))
|
||||
if err != nil {
|
||||
c.SetJSONEncodingError(err)
|
||||
return
|
||||
}
|
||||
|
||||
w.Write(b)
|
||||
}
|
||||
|
||||
func appendAncillaryPermissionsPost(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
permissions, err := model.NonSortedArrayFromJSON(r.Body)
|
||||
if err != nil || len(permissions) < 1 {
|
||||
|
||||
Ссылка в новой задаче
Block a user