mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
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>
This commit is contained in:
parent
be94c47607
commit
db138fd23a
@ -1,35 +1,4 @@
|
||||
/api/v4/permissions/ancillary:
|
||||
get:
|
||||
tags:
|
||||
- permissions
|
||||
summary: Return all system console subsection ancillary permissions
|
||||
description: >
|
||||
Returns all the ancillary permissions for the corresponding system console
|
||||
subsection permissions appended to the requested permission subsections.
|
||||
|
||||
|
||||
__Minimum server version__: 5.35
|
||||
operationId: GetAncillaryPermissions
|
||||
parameters:
|
||||
- name: subsection_permissions
|
||||
in: query
|
||||
description: >
|
||||
The subsection permissions to return the ancillary permissions for.
|
||||
These values are comma seperated.
|
||||
Ex. subsection_permissions=sysconsole_read_reporting_site_statistics,sysconsole_write_reporting_site_statistics,sysconsole_write_user_management_channels
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully returned all ancillary and requested permissions
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
"400":
|
||||
$ref: '#/components/responses/BadRequest'
|
||||
post:
|
||||
tags:
|
||||
- permissions
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user