1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-07-03 23:30:29 +02:00

MM-40542: Verify config setting in api (#2170)

* verify config setting in api

* update message

* fix lint

* update/add unit test, throw error

* fix typo
This commit is contained in:
Scott Bishel
2022-01-28 10:35:38 -07:00
committed by GitHub
parent 690dc365f5
commit bccfbd3d2f
2 changed files with 43 additions and 10 deletions

View File

@ -1170,13 +1170,22 @@ func (a *API) handlePostSharing(w http.ResponseWriter, r *http.Request) {
auditRec.AddMeta("shareID", sharing.ID)
auditRec.AddMeta("enabled", sharing.Enabled)
// Stamp ModifiedBy
ctx := r.Context()
session := ctx.Value(sessionContextKey).(*model.Session)
userID := session.UserID
if userID == SingleUser {
userID = ""
}
if !a.app.GetClientConfig().EnablePublicSharedBoards {
a.logger.Info(
"Attempt to turn on sharing for board via API failed, sharing off in configuration.",
mlog.String("boardID", sharing.ID),
mlog.String("userID", userID))
a.errorResponse(w, r.URL.Path, http.StatusInternalServerError, "Turning on sharing for board failed, see log for details.", nil)
return
}
sharing.ModifiedBy = userID
err = a.app.UpsertSharing(*container, sharing)