PLT-2600/PLT-2770 Added Get Public Link modal and added new API for public file links (#2892)

* Switched public file links to use a GetLinkModal

* Separated getFile and the new getPublicFile api calls
Этот коммит содержится в:
Harrison Healey
2016-05-05 16:35:03 -04:00
коммит произвёл Christopher Speller
родитель 696ffb4745
Коммит d2ddf40f56
15 изменённых файлов: 489 добавлений и 290 удалений

Просмотреть файл

@@ -80,6 +80,10 @@ func ApiUserRequiredTrustRequester(h func(*Context, http.ResponseWriter, *http.R
return &handler{h, true, false, true, true, false, true}
}
func ApiAppHandlerTrustRequesterIndependent(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler {
return &handler{h, false, false, true, false, true, true}
}
type handler struct {
handleFunc func(*Context, http.ResponseWriter, *http.Request)
requireUser bool
@@ -187,7 +191,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
c.SystemAdminRequired()
}
if c.Err == nil && len(c.TeamId) > 0 {
if c.Err == nil && len(c.TeamId) > 0 && !h.isTeamIndependent {
c.HasPermissionsToTeam(c.TeamId, "TeamRoute")
}
@@ -389,8 +393,13 @@ func (c *Context) RemoveSessionCookie(w http.ResponseWriter, r *http.Request) {
}
func (c *Context) SetInvalidParam(where string, name string) {
c.Err = model.NewLocAppError(where, "api.context.invalid_param.app_error", map[string]interface{}{"Name": name}, "")
c.Err.StatusCode = http.StatusBadRequest
c.Err = NewInvalidParamError(where, name)
}
func NewInvalidParamError(where string, name string) *model.AppError {
err := model.NewLocAppError(where, "api.context.invalid_param.app_error", map[string]interface{}{"Name": name}, "")
err.StatusCode = http.StatusBadRequest
return err
}
func (c *Context) SetUnknownError(where string, details string) {