mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-28 20:41:35 +00:00
Sync with mattermost 3.0
This commit is contained in:
parent
38e3bbe5c9
commit
59e6abcc11
24
vendor/github.com/42wim/matterbridge-plus/matterclient/matterclient.go
generated
vendored
24
vendor/github.com/42wim/matterbridge-plus/matterclient/matterclient.go
generated
vendored
@ -78,7 +78,7 @@ func (m *MMClient) Login() error {
|
|||||||
var logmsg = "trying login"
|
var logmsg = "trying login"
|
||||||
for {
|
for {
|
||||||
m.log.Debugf(logmsg+" %s %s %s", m.Credentials.Team, m.Credentials.Login, m.Credentials.Server)
|
m.log.Debugf(logmsg+" %s %s %s", m.Credentials.Team, m.Credentials.Login, m.Credentials.Server)
|
||||||
myinfo, appErr = m.Client.LoginByEmail(m.Credentials.Team, m.Credentials.Login, m.Credentials.Pass)
|
myinfo, appErr = m.Client.Login(m.Credentials.Login, m.Credentials.Pass)
|
||||||
if appErr != nil {
|
if appErr != nil {
|
||||||
d := b.Duration()
|
d := b.Duration()
|
||||||
m.log.Debug(appErr.DetailedError)
|
m.log.Debug(appErr.DetailedError)
|
||||||
@ -99,11 +99,23 @@ func (m *MMClient) Login() error {
|
|||||||
// reset timer
|
// reset timer
|
||||||
b.Reset()
|
b.Reset()
|
||||||
m.User = myinfo.Data.(*model.User)
|
m.User = myinfo.Data.(*model.User)
|
||||||
myinfo, _ = m.Client.GetMyTeam("")
|
|
||||||
m.Team = myinfo.Data.(*model.Team)
|
teamdata, _ := m.Client.GetAllTeamListings()
|
||||||
|
teams := teamdata.Data.(map[string]*model.Team)
|
||||||
|
for k, v := range teams {
|
||||||
|
if v.Name == m.Credentials.Team {
|
||||||
|
m.Client.SetTeamId(k)
|
||||||
|
m.Team = v
|
||||||
|
m.log.Debug("GetallTeamListings: found id ", k)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if m.Team == nil {
|
||||||
|
return errors.New("team not found")
|
||||||
|
}
|
||||||
|
|
||||||
// setup websocket connection
|
// setup websocket connection
|
||||||
wsurl := wsScheme + m.Credentials.Server + "/api/v1/websocket"
|
wsurl := wsScheme + m.Credentials.Server + "/api/v3/users/websocket"
|
||||||
header := http.Header{}
|
header := http.Header{}
|
||||||
header.Set(model.HEADER_AUTH, "BEARER "+m.Client.AuthToken)
|
header.Set(model.HEADER_AUTH, "BEARER "+m.Client.AuthToken)
|
||||||
|
|
||||||
@ -186,7 +198,7 @@ func (m *MMClient) parseActionPost(rmsg *Message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *MMClient) UpdateUsers() error {
|
func (m *MMClient) UpdateUsers() error {
|
||||||
mmusers, _ := m.Client.GetProfiles(m.User.TeamId, "")
|
mmusers, _ := m.Client.GetProfiles(m.Client.GetTeamId(), "")
|
||||||
m.Users = mmusers.Data.(map[string]*model.User)
|
m.Users = mmusers.Data.(map[string]*model.User)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -267,7 +279,7 @@ func (m *MMClient) GetPostsSince(channelId string, time int64) *model.PostList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *MMClient) SearchPosts(query string) *model.PostList {
|
func (m *MMClient) SearchPosts(query string) *model.PostList {
|
||||||
res, err := m.Client.SearchPosts(query)
|
res, err := m.Client.SearchPosts(query, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
4
vendor/github.com/mattermost/platform/einterfaces/LICENSE.txt
generated
vendored
4
vendor/github.com/mattermost/platform/einterfaces/LICENSE.txt
generated
vendored
@ -11,8 +11,8 @@ You may be licensed to use source code to create compiled versions not produced
|
|||||||
1. Under the Free Software Foundation’s GNU AGPL v.3.0, subject to the exceptions outlined in this policy; or
|
1. Under the Free Software Foundation’s GNU AGPL v.3.0, subject to the exceptions outlined in this policy; or
|
||||||
2. Under a commercial license available from Mattermost, Inc. by contacting commercial@mattermost.com
|
2. Under a commercial license available from Mattermost, Inc. by contacting commercial@mattermost.com
|
||||||
|
|
||||||
You are licensed to use the source code in Admin Tools and Configuration Files (api/templates/, config/, model/,
|
You are licensed to use the source code in Admin Tools and Configuration Files (templates/, config/, model/,
|
||||||
web/react/utils/, web/static/, web/templates/ and all subdirectories thereof) under the Apache License v2.0.
|
webapp/client, webapp/fonts, webapp/i18n, webapp/images and all subdirectories thereof) under the Apache License v2.0.
|
||||||
|
|
||||||
We promise that we will not enforce the copyleft provisions in AGPL v3.0 against you if your application (a) does not
|
We promise that we will not enforce the copyleft provisions in AGPL v3.0 against you if your application (a) does not
|
||||||
link to the Mattermost Platform directly, but exclusively uses the Mattermost Admin Tools and Configuration Files, and
|
link to the Mattermost Platform directly, but exclusively uses the Mattermost Admin Tools and Configuration Files, and
|
||||||
|
4
vendor/github.com/mattermost/platform/einterfaces/ldap.go
generated
vendored
4
vendor/github.com/mattermost/platform/einterfaces/ldap.go
generated
vendored
@ -8,9 +8,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type LdapInterface interface {
|
type LdapInterface interface {
|
||||||
DoLogin(team *model.Team, id string, password string) (*model.User, *model.AppError)
|
DoLogin(id string, password string) (*model.User, *model.AppError)
|
||||||
GetUser(id string) (*model.User, *model.AppError)
|
GetUser(id string) (*model.User, *model.AppError)
|
||||||
CheckPassword(id string, password string) *model.AppError
|
CheckPassword(id string, password string) *model.AppError
|
||||||
|
SwitchToLdap(userId, ldapId, ldapPassword string) *model.AppError
|
||||||
|
ValidateFilter(filter string) *model.AppError
|
||||||
}
|
}
|
||||||
|
|
||||||
var theLdapInterface LdapInterface
|
var theLdapInterface LdapInterface
|
||||||
|
4
vendor/github.com/mattermost/platform/model/LICENSE.txt
generated
vendored
4
vendor/github.com/mattermost/platform/model/LICENSE.txt
generated
vendored
@ -11,8 +11,8 @@ You may be licensed to use source code to create compiled versions not produced
|
|||||||
1. Under the Free Software Foundation’s GNU AGPL v.3.0, subject to the exceptions outlined in this policy; or
|
1. Under the Free Software Foundation’s GNU AGPL v.3.0, subject to the exceptions outlined in this policy; or
|
||||||
2. Under a commercial license available from Mattermost, Inc. by contacting commercial@mattermost.com
|
2. Under a commercial license available from Mattermost, Inc. by contacting commercial@mattermost.com
|
||||||
|
|
||||||
You are licensed to use the source code in Admin Tools and Configuration Files (api/templates/, config/, model/,
|
You are licensed to use the source code in Admin Tools and Configuration Files (templates/, config/, model/,
|
||||||
web/react/utils/, web/static/, web/templates/ and all subdirectories thereof) under the Apache License v2.0.
|
webapp/client, webapp/fonts, webapp/i18n, webapp/images and all subdirectories thereof) under the Apache License v2.0.
|
||||||
|
|
||||||
We promise that we will not enforce the copyleft provisions in AGPL v3.0 against you if your application (a) does not
|
We promise that we will not enforce the copyleft provisions in AGPL v3.0 against you if your application (a) does not
|
||||||
link to the Mattermost Platform directly, but exclusively uses the Mattermost Admin Tools and Configuration Files, and
|
link to the Mattermost Platform directly, but exclusively uses the Mattermost Admin Tools and Configuration Files, and
|
||||||
|
462
vendor/github.com/mattermost/platform/model/client.go
generated
vendored
462
vendor/github.com/mattermost/platform/model/client.go
generated
vendored
@ -16,21 +16,22 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
HEADER_REQUEST_ID = "X-Request-ID"
|
HEADER_REQUEST_ID = "X-Request-ID"
|
||||||
HEADER_VERSION_ID = "X-Version-ID"
|
HEADER_VERSION_ID = "X-Version-ID"
|
||||||
HEADER_ETAG_SERVER = "ETag"
|
HEADER_ETAG_SERVER = "ETag"
|
||||||
HEADER_ETAG_CLIENT = "If-None-Match"
|
HEADER_ETAG_CLIENT = "If-None-Match"
|
||||||
HEADER_FORWARDED = "X-Forwarded-For"
|
HEADER_FORWARDED = "X-Forwarded-For"
|
||||||
HEADER_REAL_IP = "X-Real-IP"
|
HEADER_REAL_IP = "X-Real-IP"
|
||||||
HEADER_FORWARDED_PROTO = "X-Forwarded-Proto"
|
HEADER_FORWARDED_PROTO = "X-Forwarded-Proto"
|
||||||
HEADER_TOKEN = "token"
|
HEADER_TOKEN = "token"
|
||||||
HEADER_BEARER = "BEARER"
|
HEADER_BEARER = "BEARER"
|
||||||
HEADER_AUTH = "Authorization"
|
HEADER_AUTH = "Authorization"
|
||||||
HEADER_MM_SESSION_TOKEN_INDEX = "X-MM-TokenIndex"
|
HEADER_REQUESTED_WITH = "X-Requested-With"
|
||||||
SESSION_TOKEN_INDEX = "session_token_index"
|
HEADER_REQUESTED_WITH_XML = "XMLHttpRequest"
|
||||||
HEADER_REQUESTED_WITH = "X-Requested-With"
|
|
||||||
HEADER_REQUESTED_WITH_XML = "XMLHttpRequest"
|
API_URL_SUFFIX_V1 = "/api/v1"
|
||||||
API_URL_SUFFIX = "/api/v1"
|
API_URL_SUFFIX_V3 = "/api/v3"
|
||||||
|
API_URL_SUFFIX = API_URL_SUFFIX_V3
|
||||||
)
|
)
|
||||||
|
|
||||||
type Result struct {
|
type Result struct {
|
||||||
@ -41,16 +42,56 @@ type Result struct {
|
|||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
Url string // The location of the server like "http://localhost:8065"
|
Url string // The location of the server like "http://localhost:8065"
|
||||||
ApiUrl string // The api location of the server like "http://localhost:8065/api/v1"
|
ApiUrl string // The api location of the server like "http://localhost:8065/api/v3"
|
||||||
HttpClient *http.Client // The http client
|
HttpClient *http.Client // The http client
|
||||||
AuthToken string
|
AuthToken string
|
||||||
AuthType string
|
AuthType string
|
||||||
|
TeamId string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClient constructs a new client with convienence methods for talking to
|
// NewClient constructs a new client with convienence methods for talking to
|
||||||
// the server.
|
// the server.
|
||||||
func NewClient(url string) *Client {
|
func NewClient(url string) *Client {
|
||||||
return &Client{url, url + API_URL_SUFFIX, &http.Client{}, "", ""}
|
return &Client{url, url + API_URL_SUFFIX, &http.Client{}, "", "", ""}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) SetOAuthToken(token string) {
|
||||||
|
c.AuthToken = token
|
||||||
|
c.AuthType = HEADER_TOKEN
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) ClearOAuthToken() {
|
||||||
|
c.AuthToken = ""
|
||||||
|
c.AuthType = HEADER_BEARER
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) SetTeamId(teamId string) {
|
||||||
|
c.TeamId = teamId
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetTeamId() string {
|
||||||
|
if len(c.TeamId) == 0 {
|
||||||
|
println(`You are trying to use a route that requires a team_id,
|
||||||
|
but you have not called SetTeamId() in client.go`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.TeamId
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) ClearTeamId() {
|
||||||
|
c.TeamId = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetTeamRoute() string {
|
||||||
|
return fmt.Sprintf("/teams/%v", c.GetTeamId())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetChannelRoute(channelId string) string {
|
||||||
|
return fmt.Sprintf("/teams/%v/channels/%v", c.GetTeamId(), channelId)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetChannelNameRoute(channelName string) string {
|
||||||
|
return fmt.Sprintf("/teams/%v/channels/name/%v", c.GetTeamId(), channelName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) DoPost(url, data, contentType string) (*http.Response, *AppError) {
|
func (c *Client) DoPost(url, data, contentType string) (*http.Response, *AppError) {
|
||||||
@ -164,10 +205,19 @@ func (c *Client) GetAllTeams() (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) FindTeamByName(name string, allServers bool) (*Result, *AppError) {
|
func (c *Client) GetAllTeamListings() (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiGet("/teams/all_team_listings", "", ""); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), TeamMapFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) FindTeamByName(name string) (*Result, *AppError) {
|
||||||
m := make(map[string]string)
|
m := make(map[string]string)
|
||||||
m["name"] = name
|
m["name"] = name
|
||||||
m["all"] = fmt.Sprintf("%v", allServers)
|
|
||||||
if r, err := c.DoApiPost("/teams/find_team_by_name", MapToJson(m)); err != nil {
|
if r, err := c.DoApiPost("/teams/find_team_by_name", MapToJson(m)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
@ -181,31 +231,32 @@ func (c *Client) FindTeamByName(name string, allServers bool) (*Result, *AppErro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) FindTeams(email string) (*Result, *AppError) {
|
func (c *Client) AddUserToTeam(userId string) (*Result, *AppError) {
|
||||||
m := make(map[string]string)
|
data := make(map[string]string)
|
||||||
m["email"] = email
|
data["user_id"] = userId
|
||||||
if r, err := c.DoApiPost("/teams/find_teams", MapToJson(m)); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/add_user_to_team", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
r.Header.Get(HEADER_ETAG_SERVER), TeamMapFromJson(r.Body)}, nil
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) FindTeamsSendEmail(email string) (*Result, *AppError) {
|
func (c *Client) AddUserToTeamFromInvite(hash, dataToHash, inviteId string) (*Result, *AppError) {
|
||||||
m := make(map[string]string)
|
data := make(map[string]string)
|
||||||
m["email"] = email
|
data["hash"] = hash
|
||||||
if r, err := c.DoApiPost("/teams/email_teams", MapToJson(m)); err != nil {
|
data["data"] = dataToHash
|
||||||
|
data["invite_id"] = inviteId
|
||||||
|
if r, err := c.DoApiPost("/teams/add_user_to_team_from_invite", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
r.Header.Get(HEADER_ETAG_SERVER), ArrayFromJson(r.Body)}, nil
|
r.Header.Get(HEADER_ETAG_SERVER), TeamFromJson(r.Body)}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) InviteMembers(invites *Invites) (*Result, *AppError) {
|
func (c *Client) InviteMembers(invites *Invites) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/teams/invite_members", invites.ToJson()); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/invite_members", invites.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -214,7 +265,7 @@ func (c *Client) InviteMembers(invites *Invites) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UpdateTeam(team *Team) (*Result, *AppError) {
|
func (c *Client) UpdateTeam(team *Team) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/teams/update", team.ToJson()); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/update", team.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -231,6 +282,18 @@ func (c *Client) CreateUser(user *User, hash string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) CreateUserWithInvite(user *User, hash string, data string, inviteId string) (*Result, *AppError) {
|
||||||
|
|
||||||
|
url := "/users/create?d=" + url.QueryEscape(data) + "&h=" + url.QueryEscape(hash) + "&iid=" + url.QueryEscape(inviteId)
|
||||||
|
|
||||||
|
if r, err := c.DoApiPost(url, user.ToJson()); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), UserFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) CreateUserFromSignup(user *User, data string, hash string) (*Result, *AppError) {
|
func (c *Client) CreateUserFromSignup(user *User, data string, hash string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/users/create?d="+url.QueryEscape(data)+"&h="+hash, user.ToJson()); err != nil {
|
if r, err := c.DoApiPost("/users/create?d="+url.QueryEscape(data)+"&h="+hash, user.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -241,7 +304,7 @@ func (c *Client) CreateUserFromSignup(user *User, data string, hash string) (*Re
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetUser(id string, etag string) (*Result, *AppError) {
|
func (c *Client) GetUser(id string, etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/users/"+id, "", etag); err != nil {
|
if r, err := c.DoApiGet("/users/"+id+"/get", "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -258,6 +321,15 @@ func (c *Client) GetMe(etag string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetProfilesForDirectMessageList(teamId string) (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiGet("/users/profiles_for_dm_list/"+teamId, "", ""); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), UserMapFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) GetProfiles(teamId string, etag string) (*Result, *AppError) {
|
func (c *Client) GetProfiles(teamId string, etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/users/profiles/"+teamId, "", etag); err != nil {
|
if r, err := c.DoApiGet("/users/profiles/"+teamId, "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -267,6 +339,15 @@ func (c *Client) GetProfiles(teamId string, etag string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetDirectProfiles(etag string) (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiGet("/users/direct_profiles", "", etag); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), UserMapFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) LoginById(id string, password string) (*Result, *AppError) {
|
func (c *Client) LoginById(id string, password string) (*Result, *AppError) {
|
||||||
m := make(map[string]string)
|
m := make(map[string]string)
|
||||||
m["id"] = id
|
m["id"] = id
|
||||||
@ -274,26 +355,24 @@ func (c *Client) LoginById(id string, password string) (*Result, *AppError) {
|
|||||||
return c.login(m)
|
return c.login(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) LoginByEmail(name string, email string, password string) (*Result, *AppError) {
|
func (c *Client) Login(loginId string, password string) (*Result, *AppError) {
|
||||||
m := make(map[string]string)
|
m := make(map[string]string)
|
||||||
m["name"] = name
|
m["login_id"] = loginId
|
||||||
m["email"] = email
|
|
||||||
m["password"] = password
|
m["password"] = password
|
||||||
return c.login(m)
|
return c.login(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) LoginByUsername(name string, username string, password string) (*Result, *AppError) {
|
func (c *Client) LoginByLdap(loginId string, password string) (*Result, *AppError) {
|
||||||
m := make(map[string]string)
|
m := make(map[string]string)
|
||||||
m["name"] = name
|
m["login_id"] = loginId
|
||||||
m["username"] = username
|
|
||||||
m["password"] = password
|
m["password"] = password
|
||||||
|
m["ldap_only"] = "true"
|
||||||
return c.login(m)
|
return c.login(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) LoginByEmailWithDevice(name string, email string, password string, deviceId string) (*Result, *AppError) {
|
func (c *Client) LoginWithDevice(loginId string, password string, deviceId string) (*Result, *AppError) {
|
||||||
m := make(map[string]string)
|
m := make(map[string]string)
|
||||||
m["name"] = name
|
m["login_id"] = loginId
|
||||||
m["email"] = email
|
|
||||||
m["password"] = password
|
m["password"] = password
|
||||||
m["device_id"] = deviceId
|
m["device_id"] = deviceId
|
||||||
return c.login(m)
|
return c.login(m)
|
||||||
@ -322,20 +401,57 @@ func (c *Client) Logout() (*Result, *AppError) {
|
|||||||
} else {
|
} else {
|
||||||
c.AuthToken = ""
|
c.AuthToken = ""
|
||||||
c.AuthType = HEADER_BEARER
|
c.AuthType = HEADER_BEARER
|
||||||
|
c.TeamId = ""
|
||||||
|
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) SetOAuthToken(token string) {
|
func (c *Client) CheckMfa(loginId string) (*Result, *AppError) {
|
||||||
c.AuthToken = token
|
m := make(map[string]string)
|
||||||
c.AuthType = HEADER_TOKEN
|
m["login_id"] = loginId
|
||||||
|
|
||||||
|
if r, err := c.DoApiPost("/users/mfa", MapToJson(m)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ClearOAuthToken() {
|
func (c *Client) GenerateMfaQrCode() (*Result, *AppError) {
|
||||||
c.AuthToken = ""
|
if r, err := c.DoApiGet("/users/generate_mfa_qr", "", ""); err != nil {
|
||||||
c.AuthType = HEADER_BEARER
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), r.Body}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) UpdateMfa(activate bool, token string) (*Result, *AppError) {
|
||||||
|
m := make(map[string]interface{})
|
||||||
|
m["activate"] = activate
|
||||||
|
m["token"] = token
|
||||||
|
|
||||||
|
if r, err := c.DoApiPost("/users/update_mfa", StringInterfaceToJson(m)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) AdminResetMfa(userId string) (*Result, *AppError) {
|
||||||
|
m := make(map[string]string)
|
||||||
|
m["user_id"] = userId
|
||||||
|
|
||||||
|
if r, err := c.DoApiPost("/admin/reset_mfa", MapToJson(m)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) RevokeSession(sessionAltId string) (*Result, *AppError) {
|
func (c *Client) RevokeSession(sessionAltId string) (*Result, *AppError) {
|
||||||
@ -359,8 +475,8 @@ func (c *Client) GetSessions(id string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) SwitchToSSO(m map[string]string) (*Result, *AppError) {
|
func (c *Client) EmailToOAuth(m map[string]string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/users/switch_to_sso", MapToJson(m)); err != nil {
|
if r, err := c.DoApiPost("/users/claim/email_to_sso", MapToJson(m)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -368,8 +484,26 @@ func (c *Client) SwitchToSSO(m map[string]string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) SwitchToEmail(m map[string]string) (*Result, *AppError) {
|
func (c *Client) OAuthToEmail(m map[string]string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/users/switch_to_email", MapToJson(m)); err != nil {
|
if r, err := c.DoApiPost("/users/claim/oauth_to_email", MapToJson(m)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) LDAPToEmail(m map[string]string) (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiPost("/users/claim/ldap_to_email", MapToJson(m)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) EmailToLDAP(m map[string]string) (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiPost("/users/claim/ldap_to_email", MapToJson(m)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -382,7 +516,7 @@ func (c *Client) Command(channelId string, command string, suggest bool) (*Resul
|
|||||||
m["command"] = command
|
m["command"] = command
|
||||||
m["channelId"] = channelId
|
m["channelId"] = channelId
|
||||||
m["suggest"] = strconv.FormatBool(suggest)
|
m["suggest"] = strconv.FormatBool(suggest)
|
||||||
if r, err := c.DoApiPost("/commands/execute", MapToJson(m)); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/commands/execute", MapToJson(m)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -391,7 +525,7 @@ func (c *Client) Command(channelId string, command string, suggest bool) (*Resul
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ListCommands() (*Result, *AppError) {
|
func (c *Client) ListCommands() (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/commands/list", "", ""); err != nil {
|
if r, err := c.DoApiGet(c.GetTeamRoute()+"/commands/list", "", ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -400,7 +534,7 @@ func (c *Client) ListCommands() (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ListTeamCommands() (*Result, *AppError) {
|
func (c *Client) ListTeamCommands() (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/commands/list_team_commands", "", ""); err != nil {
|
if r, err := c.DoApiGet(c.GetTeamRoute()+"/commands/list_team_commands", "", ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -409,7 +543,7 @@ func (c *Client) ListTeamCommands() (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) CreateCommand(cmd *Command) (*Result, *AppError) {
|
func (c *Client) CreateCommand(cmd *Command) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/commands/create", cmd.ToJson()); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/commands/create", cmd.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -418,7 +552,7 @@ func (c *Client) CreateCommand(cmd *Command) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) RegenCommandToken(data map[string]string) (*Result, *AppError) {
|
func (c *Client) RegenCommandToken(data map[string]string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/commands/regen_token", MapToJson(data)); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/commands/regen_token", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -427,7 +561,7 @@ func (c *Client) RegenCommandToken(data map[string]string) (*Result, *AppError)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) DeleteCommand(data map[string]string) (*Result, *AppError) {
|
func (c *Client) DeleteCommand(data map[string]string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/commands/delete", MapToJson(data)); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/commands/delete", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -485,7 +619,7 @@ func (c *Client) SaveConfig(config *Config) (*Result, *AppError) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
r.Header.Get(HEADER_ETAG_SERVER), ConfigFromJson(r.Body)}, nil
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,6 +632,42 @@ func (c *Client) TestEmail(config *Config) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetComplianceReports() (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiGet("/admin/compliance_reports", "", ""); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), CompliancesFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) SaveComplianceReport(job *Compliance) (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiPost("/admin/save_compliance_report", job.ToJson()); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), ComplianceFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) DownloadComplianceReport(id string) (*Result, *AppError) {
|
||||||
|
var rq *http.Request
|
||||||
|
rq, _ = http.NewRequest("GET", c.ApiUrl+"/admin/download_compliance_report/"+id, nil)
|
||||||
|
|
||||||
|
if len(c.AuthToken) > 0 {
|
||||||
|
rq.Header.Set(HEADER_AUTH, "BEARER "+c.AuthToken)
|
||||||
|
}
|
||||||
|
|
||||||
|
if rp, err := c.HttpClient.Do(rq); err != nil {
|
||||||
|
return nil, NewLocAppError("/admin/download_compliance_report", "model.client.connecting.app_error", nil, err.Error())
|
||||||
|
} else if rp.StatusCode >= 300 {
|
||||||
|
return nil, AppErrorFromJson(rp.Body)
|
||||||
|
} else {
|
||||||
|
return &Result{rp.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
rp.Header.Get(HEADER_ETAG_SERVER), rp.Body}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) GetTeamAnalytics(teamId, name string) (*Result, *AppError) {
|
func (c *Client) GetTeamAnalytics(teamId, name string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/admin/analytics/"+teamId+"/"+name, "", ""); err != nil {
|
if r, err := c.DoApiGet("/admin/analytics/"+teamId+"/"+name, "", ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -517,7 +687,7 @@ func (c *Client) GetSystemAnalytics(name string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError) {
|
func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/create", channel.ToJson()); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/channels/create", channel.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -525,8 +695,10 @@ func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) CreateDirectChannel(data map[string]string) (*Result, *AppError) {
|
func (c *Client) CreateDirectChannel(userId string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/create_direct", MapToJson(data)); err != nil {
|
data := make(map[string]string)
|
||||||
|
data["user_id"] = userId
|
||||||
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/channels/create_direct", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -535,7 +707,7 @@ func (c *Client) CreateDirectChannel(data map[string]string) (*Result, *AppError
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UpdateChannel(channel *Channel) (*Result, *AppError) {
|
func (c *Client) UpdateChannel(channel *Channel) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/update", channel.ToJson()); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/channels/update", channel.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -544,7 +716,7 @@ func (c *Client) UpdateChannel(channel *Channel) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UpdateChannelHeader(data map[string]string) (*Result, *AppError) {
|
func (c *Client) UpdateChannelHeader(data map[string]string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/update_header", MapToJson(data)); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/channels/update_header", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -553,7 +725,7 @@ func (c *Client) UpdateChannelHeader(data map[string]string) (*Result, *AppError
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UpdateChannelPurpose(data map[string]string) (*Result, *AppError) {
|
func (c *Client) UpdateChannelPurpose(data map[string]string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/update_purpose", MapToJson(data)); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/channels/update_purpose", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -562,7 +734,7 @@ func (c *Client) UpdateChannelPurpose(data map[string]string) (*Result, *AppErro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UpdateNotifyProps(data map[string]string) (*Result, *AppError) {
|
func (c *Client) UpdateNotifyProps(data map[string]string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/update_notify_props", MapToJson(data)); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/channels/update_notify_props", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -571,7 +743,7 @@ func (c *Client) UpdateNotifyProps(data map[string]string) (*Result, *AppError)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetChannels(etag string) (*Result, *AppError) {
|
func (c *Client) GetChannels(etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/channels/", "", etag); err != nil {
|
if r, err := c.DoApiGet(c.GetTeamRoute()+"/channels/", "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -580,7 +752,7 @@ func (c *Client) GetChannels(etag string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetChannel(id, etag string) (*Result, *AppError) {
|
func (c *Client) GetChannel(id, etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/channels/"+id+"/", "", etag); err != nil {
|
if r, err := c.DoApiGet(c.GetChannelRoute(id)+"/", "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -589,7 +761,7 @@ func (c *Client) GetChannel(id, etag string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetMoreChannels(etag string) (*Result, *AppError) {
|
func (c *Client) GetMoreChannels(etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/channels/more", "", etag); err != nil {
|
if r, err := c.DoApiGet(c.GetTeamRoute()+"/channels/more", "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -598,7 +770,7 @@ func (c *Client) GetMoreChannels(etag string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetChannelCounts(etag string) (*Result, *AppError) {
|
func (c *Client) GetChannelCounts(etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/channels/counts", "", etag); err != nil {
|
if r, err := c.DoApiGet(c.GetTeamRoute()+"/channels/counts", "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -607,7 +779,16 @@ func (c *Client) GetChannelCounts(etag string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) JoinChannel(id string) (*Result, *AppError) {
|
func (c *Client) JoinChannel(id string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/"+id+"/join", ""); err != nil {
|
if r, err := c.DoApiPost(c.GetChannelRoute(id)+"/join", ""); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), nil}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) JoinChannelByName(name string) (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiPost(c.GetChannelNameRoute(name)+"/join", ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -616,7 +797,7 @@ func (c *Client) JoinChannel(id string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) LeaveChannel(id string) (*Result, *AppError) {
|
func (c *Client) LeaveChannel(id string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/"+id+"/leave", ""); err != nil {
|
if r, err := c.DoApiPost(c.GetChannelRoute(id)+"/leave", ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -625,7 +806,7 @@ func (c *Client) LeaveChannel(id string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) DeleteChannel(id string) (*Result, *AppError) {
|
func (c *Client) DeleteChannel(id string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/"+id+"/delete", ""); err != nil {
|
if r, err := c.DoApiPost(c.GetChannelRoute(id)+"/delete", ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -636,7 +817,7 @@ func (c *Client) DeleteChannel(id string) (*Result, *AppError) {
|
|||||||
func (c *Client) AddChannelMember(id, user_id string) (*Result, *AppError) {
|
func (c *Client) AddChannelMember(id, user_id string) (*Result, *AppError) {
|
||||||
data := make(map[string]string)
|
data := make(map[string]string)
|
||||||
data["user_id"] = user_id
|
data["user_id"] = user_id
|
||||||
if r, err := c.DoApiPost("/channels/"+id+"/add", MapToJson(data)); err != nil {
|
if r, err := c.DoApiPost(c.GetChannelRoute(id)+"/add", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -647,7 +828,7 @@ func (c *Client) AddChannelMember(id, user_id string) (*Result, *AppError) {
|
|||||||
func (c *Client) RemoveChannelMember(id, user_id string) (*Result, *AppError) {
|
func (c *Client) RemoveChannelMember(id, user_id string) (*Result, *AppError) {
|
||||||
data := make(map[string]string)
|
data := make(map[string]string)
|
||||||
data["user_id"] = user_id
|
data["user_id"] = user_id
|
||||||
if r, err := c.DoApiPost("/channels/"+id+"/remove", MapToJson(data)); err != nil {
|
if r, err := c.DoApiPost(c.GetChannelRoute(id)+"/remove", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -656,7 +837,7 @@ func (c *Client) RemoveChannelMember(id, user_id string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UpdateLastViewedAt(channelId string) (*Result, *AppError) {
|
func (c *Client) UpdateLastViewedAt(channelId string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/"+channelId+"/update_last_viewed_at", ""); err != nil {
|
if r, err := c.DoApiPost(c.GetChannelRoute(channelId)+"/update_last_viewed_at", ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -665,7 +846,7 @@ func (c *Client) UpdateLastViewedAt(channelId string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetChannelExtraInfo(id string, memberLimit int, etag string) (*Result, *AppError) {
|
func (c *Client) GetChannelExtraInfo(id string, memberLimit int, etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/channels/"+id+"/extra_info/"+strconv.FormatInt(int64(memberLimit), 10), "", etag); err != nil {
|
if r, err := c.DoApiGet(c.GetChannelRoute(id)+"/extra_info/"+strconv.FormatInt(int64(memberLimit), 10), "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -674,7 +855,7 @@ func (c *Client) GetChannelExtraInfo(id string, memberLimit int, etag string) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) CreatePost(post *Post) (*Result, *AppError) {
|
func (c *Client) CreatePost(post *Post) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/"+post.ChannelId+"/create", post.ToJson()); err != nil {
|
if r, err := c.DoApiPost(c.GetChannelRoute(post.ChannelId)+"/posts/create", post.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -683,7 +864,7 @@ func (c *Client) CreatePost(post *Post) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UpdatePost(post *Post) (*Result, *AppError) {
|
func (c *Client) UpdatePost(post *Post) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/channels/"+post.ChannelId+"/update", post.ToJson()); err != nil {
|
if r, err := c.DoApiPost(c.GetChannelRoute(post.ChannelId)+"/posts/update", post.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -692,7 +873,7 @@ func (c *Client) UpdatePost(post *Post) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetPosts(channelId string, offset int, limit int, etag string) (*Result, *AppError) {
|
func (c *Client) GetPosts(channelId string, offset int, limit int, etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet(fmt.Sprintf("/channels/%v/posts/%v/%v", channelId, offset, limit), "", etag); err != nil {
|
if r, err := c.DoApiGet(c.GetChannelRoute(channelId)+fmt.Sprintf("/posts/page/%v/%v", offset, limit), "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -701,7 +882,7 @@ func (c *Client) GetPosts(channelId string, offset int, limit int, etag string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetPostsSince(channelId string, time int64) (*Result, *AppError) {
|
func (c *Client) GetPostsSince(channelId string, time int64) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet(fmt.Sprintf("/channels/%v/posts/%v", channelId, time), "", ""); err != nil {
|
if r, err := c.DoApiGet(c.GetChannelRoute(channelId)+fmt.Sprintf("/posts/since/%v", time), "", ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -710,7 +891,7 @@ func (c *Client) GetPostsSince(channelId string, time int64) (*Result, *AppError
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetPostsBefore(channelId string, postid string, offset int, limit int, etag string) (*Result, *AppError) {
|
func (c *Client) GetPostsBefore(channelId string, postid string, offset int, limit int, etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet(fmt.Sprintf("/channels/%v/post/%v/before/%v/%v", channelId, postid, offset, limit), "", etag); err != nil {
|
if r, err := c.DoApiGet(c.GetChannelRoute(channelId)+fmt.Sprintf("/posts/%v/before/%v/%v", postid, offset, limit), "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -719,7 +900,7 @@ func (c *Client) GetPostsBefore(channelId string, postid string, offset int, lim
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetPostsAfter(channelId string, postid string, offset int, limit int, etag string) (*Result, *AppError) {
|
func (c *Client) GetPostsAfter(channelId string, postid string, offset int, limit int, etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet(fmt.Sprintf("/channels/%v/post/%v/after/%v/%v", channelId, postid, offset, limit), "", etag); err != nil {
|
if r, err := c.DoApiGet(fmt.Sprintf(c.GetChannelRoute(channelId)+"/posts/%v/after/%v/%v", postid, offset, limit), "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -728,7 +909,7 @@ func (c *Client) GetPostsAfter(channelId string, postid string, offset int, limi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetPost(channelId string, postId string, etag string) (*Result, *AppError) {
|
func (c *Client) GetPost(channelId string, postId string, etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet(fmt.Sprintf("/channels/%v/post/%v", channelId, postId), "", etag); err != nil {
|
if r, err := c.DoApiGet(c.GetChannelRoute(channelId)+fmt.Sprintf("/posts/%v/get", postId), "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -737,7 +918,7 @@ func (c *Client) GetPost(channelId string, postId string, etag string) (*Result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) DeletePost(channelId string, postId string) (*Result, *AppError) {
|
func (c *Client) DeletePost(channelId string, postId string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost(fmt.Sprintf("/channels/%v/post/%v/delete", channelId, postId), ""); err != nil {
|
if r, err := c.DoApiPost(c.GetChannelRoute(channelId)+fmt.Sprintf("/posts/%v/delete", postId), ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -745,8 +926,11 @@ func (c *Client) DeletePost(channelId string, postId string) (*Result, *AppError
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) SearchPosts(terms string) (*Result, *AppError) {
|
func (c *Client) SearchPosts(terms string, isOrSearch bool) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/posts/search?terms="+url.QueryEscape(terms), "", ""); err != nil {
|
data := map[string]interface{}{}
|
||||||
|
data["terms"] = terms
|
||||||
|
data["is_or_search"] = isOrSearch
|
||||||
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/posts/search", StringInterfaceToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -754,8 +938,16 @@ func (c *Client) SearchPosts(terms string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UploadFile(url string, data []byte, contentType string) (*Result, *AppError) {
|
func (c *Client) UploadProfileFile(data []byte, contentType string) (*Result, *AppError) {
|
||||||
rq, _ := http.NewRequest("POST", c.ApiUrl+url, bytes.NewReader(data))
|
return c.uploadFile(c.ApiUrl+"/users/newimage", data, contentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) UploadPostAttachment(data []byte, contentType string) (*Result, *AppError) {
|
||||||
|
return c.uploadFile(c.ApiUrl+c.GetTeamRoute()+"/files/upload", data, contentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) uploadFile(url string, data []byte, contentType string) (*Result, *AppError) {
|
||||||
|
rq, _ := http.NewRequest("POST", url, bytes.NewReader(data))
|
||||||
rq.Header.Set("Content-Type", contentType)
|
rq.Header.Set("Content-Type", contentType)
|
||||||
|
|
||||||
if len(c.AuthToken) > 0 {
|
if len(c.AuthToken) > 0 {
|
||||||
@ -777,7 +969,7 @@ func (c *Client) GetFile(url string, isFullUrl bool) (*Result, *AppError) {
|
|||||||
if isFullUrl {
|
if isFullUrl {
|
||||||
rq, _ = http.NewRequest("GET", url, nil)
|
rq, _ = http.NewRequest("GET", url, nil)
|
||||||
} else {
|
} else {
|
||||||
rq, _ = http.NewRequest("GET", c.ApiUrl+"/files/get"+url, nil)
|
rq, _ = http.NewRequest("GET", c.ApiUrl+c.GetTeamRoute()+"/files/get"+url, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(c.AuthToken) > 0 {
|
if len(c.AuthToken) > 0 {
|
||||||
@ -796,7 +988,7 @@ func (c *Client) GetFile(url string, isFullUrl bool) (*Result, *AppError) {
|
|||||||
|
|
||||||
func (c *Client) GetFileInfo(url string) (*Result, *AppError) {
|
func (c *Client) GetFileInfo(url string) (*Result, *AppError) {
|
||||||
var rq *http.Request
|
var rq *http.Request
|
||||||
rq, _ = http.NewRequest("GET", c.ApiUrl+"/files/get_info"+url, nil)
|
rq, _ = http.NewRequest("GET", c.ApiUrl+c.GetTeamRoute()+"/files/get_info"+url, nil)
|
||||||
|
|
||||||
if len(c.AuthToken) > 0 {
|
if len(c.AuthToken) > 0 {
|
||||||
rq.Header.Set(HEADER_AUTH, "BEARER "+c.AuthToken)
|
rq.Header.Set(HEADER_AUTH, "BEARER "+c.AuthToken)
|
||||||
@ -812,12 +1004,12 @@ func (c *Client) GetFileInfo(url string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetPublicLink(data map[string]string) (*Result, *AppError) {
|
func (c *Client) GetPublicLink(filename string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/files/get_public_link", MapToJson(data)); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/files/get_public_link", MapToJson(map[string]string{"filename": filename})); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
r.Header.Get(HEADER_ETAG_SERVER), StringFromJson(r.Body)}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,7 +1027,7 @@ func (c *Client) UpdateUserRoles(data map[string]string) (*Result, *AppError) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
r.Header.Get(HEADER_ETAG_SERVER), UserFromJson(r.Body)}, nil
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -881,11 +1073,13 @@ func (c *Client) UpdateUserPassword(userId, currentPassword, newPassword string)
|
|||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
r.Header.Get(HEADER_ETAG_SERVER), UserFromJson(r.Body)}, nil
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) SendPasswordReset(data map[string]string) (*Result, *AppError) {
|
func (c *Client) SendPasswordReset(email string) (*Result, *AppError) {
|
||||||
|
data := map[string]string{}
|
||||||
|
data["email"] = email
|
||||||
if r, err := c.DoApiPost("/users/send_password_reset", MapToJson(data)); err != nil {
|
if r, err := c.DoApiPost("/users/send_password_reset", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
@ -894,7 +1088,10 @@ func (c *Client) SendPasswordReset(data map[string]string) (*Result, *AppError)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ResetPassword(data map[string]string) (*Result, *AppError) {
|
func (c *Client) ResetPassword(code, newPassword string) (*Result, *AppError) {
|
||||||
|
data := map[string]string{}
|
||||||
|
data["code"] = code
|
||||||
|
data["new_password"] = newPassword
|
||||||
if r, err := c.DoApiPost("/users/reset_password", MapToJson(data)); err != nil {
|
if r, err := c.DoApiPost("/users/reset_password", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
@ -903,6 +1100,18 @@ func (c *Client) ResetPassword(data map[string]string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) AdminResetPassword(userId, newPassword string) (*Result, *AppError) {
|
||||||
|
data := map[string]string{}
|
||||||
|
data["user_id"] = userId
|
||||||
|
data["new_password"] = newPassword
|
||||||
|
if r, err := c.DoApiPost("/admin/reset_password", MapToJson(data)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) GetStatuses(data []string) (*Result, *AppError) {
|
func (c *Client) GetStatuses(data []string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/users/status", ArrayToJson(data)); err != nil {
|
if r, err := c.DoApiPost("/users/status", ArrayToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -913,7 +1122,7 @@ func (c *Client) GetStatuses(data []string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetMyTeam(etag string) (*Result, *AppError) {
|
func (c *Client) GetMyTeam(etag string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/teams/me", "", etag); err != nil {
|
if r, err := c.DoApiGet(c.GetTeamRoute()+"/me", "", etag); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -921,6 +1130,15 @@ func (c *Client) GetMyTeam(etag string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetTeamMembers(teamId string) (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiGet("/teams/members/"+teamId, "", ""); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), TeamMembersFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) RegisterApp(app *OAuthApp) (*Result, *AppError) {
|
func (c *Client) RegisterApp(app *OAuthApp) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/oauth/register", app.ToJson()); err != nil {
|
if r, err := c.DoApiPost("/oauth/register", app.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -940,7 +1158,7 @@ func (c *Client) AllowOAuth(rspType, clientId, redirect, scope, state string) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetAccessToken(data url.Values) (*Result, *AppError) {
|
func (c *Client) GetAccessToken(data url.Values) (*Result, *AppError) {
|
||||||
if r, err := c.DoPost("/oauth/access_token", data.Encode(), "application/x-www-form-urlencoded"); err != nil {
|
if r, err := c.DoApiPost("/oauth/access_token", data.Encode()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -949,7 +1167,7 @@ func (c *Client) GetAccessToken(data url.Values) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) CreateIncomingWebhook(hook *IncomingWebhook) (*Result, *AppError) {
|
func (c *Client) CreateIncomingWebhook(hook *IncomingWebhook) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/hooks/incoming/create", hook.ToJson()); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/hooks/incoming/create", hook.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -966,8 +1184,10 @@ func (c *Client) PostToWebhook(id, payload string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) DeleteIncomingWebhook(data map[string]string) (*Result, *AppError) {
|
func (c *Client) DeleteIncomingWebhook(id string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/hooks/incoming/delete", MapToJson(data)); err != nil {
|
data := make(map[string]string)
|
||||||
|
data["id"] = id
|
||||||
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/hooks/incoming/delete", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -976,7 +1196,7 @@ func (c *Client) DeleteIncomingWebhook(data map[string]string) (*Result, *AppErr
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ListIncomingWebhooks() (*Result, *AppError) {
|
func (c *Client) ListIncomingWebhooks() (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/hooks/incoming/list", "", ""); err != nil {
|
if r, err := c.DoApiGet(c.GetTeamRoute()+"/hooks/incoming/list", "", ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -1020,7 +1240,7 @@ func (c *Client) GetPreferenceCategory(category string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) CreateOutgoingWebhook(hook *OutgoingWebhook) (*Result, *AppError) {
|
func (c *Client) CreateOutgoingWebhook(hook *OutgoingWebhook) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/hooks/outgoing/create", hook.ToJson()); err != nil {
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/hooks/outgoing/create", hook.ToJson()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -1028,8 +1248,10 @@ func (c *Client) CreateOutgoingWebhook(hook *OutgoingWebhook) (*Result, *AppErro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) DeleteOutgoingWebhook(data map[string]string) (*Result, *AppError) {
|
func (c *Client) DeleteOutgoingWebhook(id string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/hooks/outgoing/delete", MapToJson(data)); err != nil {
|
data := make(map[string]string)
|
||||||
|
data["id"] = id
|
||||||
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/hooks/outgoing/delete", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -1038,7 +1260,7 @@ func (c *Client) DeleteOutgoingWebhook(data map[string]string) (*Result, *AppErr
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ListOutgoingWebhooks() (*Result, *AppError) {
|
func (c *Client) ListOutgoingWebhooks() (*Result, *AppError) {
|
||||||
if r, err := c.DoApiGet("/hooks/outgoing/list", "", ""); err != nil {
|
if r, err := c.DoApiGet(c.GetTeamRoute()+"/hooks/outgoing/list", "", ""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -1046,8 +1268,10 @@ func (c *Client) ListOutgoingWebhooks() (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) RegenOutgoingWebhookToken(data map[string]string) (*Result, *AppError) {
|
func (c *Client) RegenOutgoingWebhookToken(id string) (*Result, *AppError) {
|
||||||
if r, err := c.DoApiPost("/hooks/outgoing/regen_token", MapToJson(data)); err != nil {
|
data := make(map[string]string)
|
||||||
|
data["id"] = id
|
||||||
|
if r, err := c.DoApiPost(c.GetTeamRoute()+"/hooks/outgoing/regen_token", MapToJson(data)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
@ -1059,3 +1283,21 @@ func (c *Client) MockSession(sessionToken string) {
|
|||||||
c.AuthToken = sessionToken
|
c.AuthToken = sessionToken
|
||||||
c.AuthType = HEADER_BEARER
|
c.AuthType = HEADER_BEARER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetClientLicenceConfig(etag string) (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiGet("/license/client_config", "", etag); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetInitialLoad() (*Result, *AppError) {
|
||||||
|
if r, err := c.DoApiGet("/users/initial_load", "", ""); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||||
|
r.Header.Get(HEADER_ETAG_SERVER), InitialLoadFromJson(r.Body)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
11
vendor/github.com/mattermost/platform/model/command.go
generated
vendored
11
vendor/github.com/mattermost/platform/model/command.go
generated
vendored
@ -29,6 +29,7 @@ type Command struct {
|
|||||||
AutoCompleteDesc string `json:"auto_complete_desc"`
|
AutoCompleteDesc string `json:"auto_complete_desc"`
|
||||||
AutoCompleteHint string `json:"auto_complete_hint"`
|
AutoCompleteHint string `json:"auto_complete_hint"`
|
||||||
DisplayName string `json:"display_name"`
|
DisplayName string `json:"display_name"`
|
||||||
|
Description string `json:"description"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ func (o *Command) IsValid() *AppError {
|
|||||||
return NewLocAppError("Command.IsValid", "model.command.is_valid.team_id.app_error", nil, "")
|
return NewLocAppError("Command.IsValid", "model.command.is_valid.team_id.app_error", nil, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(o.Trigger) > 1024 {
|
if len(o.Trigger) == 0 || len(o.Trigger) > 128 {
|
||||||
return NewLocAppError("Command.IsValid", "model.command.is_valid.trigger.app_error", nil, "")
|
return NewLocAppError("Command.IsValid", "model.command.is_valid.trigger.app_error", nil, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +115,14 @@ func (o *Command) IsValid() *AppError {
|
|||||||
return NewLocAppError("Command.IsValid", "model.command.is_valid.method.app_error", nil, "")
|
return NewLocAppError("Command.IsValid", "model.command.is_valid.method.app_error", nil, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(o.DisplayName) > 64 {
|
||||||
|
return NewLocAppError("Command.IsValid", "model.command.is_valid.display_name.app_error", nil, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(o.Description) > 128 {
|
||||||
|
return NewLocAppError("Command.IsValid", "model.command.is_valid.description.app_error", nil, "")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
212
vendor/github.com/mattermost/platform/model/config.go
generated
vendored
212
vendor/github.com/mattermost/platform/model/config.go
generated
vendored
@ -21,6 +21,18 @@ const (
|
|||||||
|
|
||||||
SERVICE_GITLAB = "gitlab"
|
SERVICE_GITLAB = "gitlab"
|
||||||
SERVICE_GOOGLE = "google"
|
SERVICE_GOOGLE = "google"
|
||||||
|
|
||||||
|
WEBSERVER_MODE_REGULAR = "regular"
|
||||||
|
WEBSERVER_MODE_GZIP = "gzip"
|
||||||
|
WEBSERVER_MODE_DISABLED = "disabled"
|
||||||
|
|
||||||
|
GENERIC_NOTIFICATION = "generic"
|
||||||
|
FULL_NOTIFICATION = "full"
|
||||||
|
|
||||||
|
DIRECT_MESSAGE_ANY = "any"
|
||||||
|
DIRECT_MESSAGE_TEAM = "team"
|
||||||
|
|
||||||
|
FAKE_SETTING = "********************************"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ServiceSettings struct {
|
type ServiceSettings struct {
|
||||||
@ -39,6 +51,7 @@ type ServiceSettings struct {
|
|||||||
EnableDeveloper *bool
|
EnableDeveloper *bool
|
||||||
EnableSecurityFixAlert *bool
|
EnableSecurityFixAlert *bool
|
||||||
EnableInsecureOutgoingConnections *bool
|
EnableInsecureOutgoingConnections *bool
|
||||||
|
EnableMultifactorAuthentication *bool
|
||||||
AllowCorsFrom *string
|
AllowCorsFrom *string
|
||||||
SessionLengthWebInDays *int
|
SessionLengthWebInDays *int
|
||||||
SessionLengthMobileInDays *int
|
SessionLengthMobileInDays *int
|
||||||
@ -46,6 +59,7 @@ type ServiceSettings struct {
|
|||||||
SessionCacheInMinutes *int
|
SessionCacheInMinutes *int
|
||||||
WebsocketSecurePort *int
|
WebsocketSecurePort *int
|
||||||
WebsocketPort *int
|
WebsocketPort *int
|
||||||
|
WebserverMode *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type SSOSettings struct {
|
type SSOSettings struct {
|
||||||
@ -116,6 +130,7 @@ type EmailSettings struct {
|
|||||||
PasswordResetSalt string
|
PasswordResetSalt string
|
||||||
SendPushNotifications *bool
|
SendPushNotifications *bool
|
||||||
PushNotificationServer *string
|
PushNotificationServer *string
|
||||||
|
PushNotificationContents *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type RateLimitSettings struct {
|
type RateLimitSettings struct {
|
||||||
@ -145,44 +160,63 @@ type TeamSettings struct {
|
|||||||
MaxUsersPerTeam int
|
MaxUsersPerTeam int
|
||||||
EnableTeamCreation bool
|
EnableTeamCreation bool
|
||||||
EnableUserCreation bool
|
EnableUserCreation bool
|
||||||
|
EnableOpenServer *bool
|
||||||
RestrictCreationToDomains string
|
RestrictCreationToDomains string
|
||||||
RestrictTeamNames *bool
|
RestrictTeamNames *bool
|
||||||
EnableTeamListing *bool
|
EnableCustomBrand *bool
|
||||||
|
CustomBrandText *string
|
||||||
|
RestrictDirectMessage *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type LdapSettings struct {
|
type LdapSettings struct {
|
||||||
// Basic
|
// Basic
|
||||||
Enable *bool
|
Enable *bool
|
||||||
LdapServer *string
|
LdapServer *string
|
||||||
LdapPort *int
|
LdapPort *int
|
||||||
BaseDN *string
|
ConnectionSecurity *string
|
||||||
BindUsername *string
|
BaseDN *string
|
||||||
BindPassword *string
|
BindUsername *string
|
||||||
|
BindPassword *string
|
||||||
|
|
||||||
|
// Filtering
|
||||||
|
UserFilter *string
|
||||||
|
|
||||||
// User Mapping
|
// User Mapping
|
||||||
FirstNameAttribute *string
|
FirstNameAttribute *string
|
||||||
LastNameAttribute *string
|
LastNameAttribute *string
|
||||||
EmailAttribute *string
|
EmailAttribute *string
|
||||||
UsernameAttribute *string
|
UsernameAttribute *string
|
||||||
|
NicknameAttribute *string
|
||||||
IdAttribute *string
|
IdAttribute *string
|
||||||
|
|
||||||
// Advanced
|
// Advanced
|
||||||
QueryTimeout *int
|
SkipCertificateVerification *bool
|
||||||
|
QueryTimeout *int
|
||||||
|
|
||||||
|
// Customization
|
||||||
|
LoginFieldName *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type ComplianceSettings struct {
|
||||||
|
Enable *bool
|
||||||
|
Directory *string
|
||||||
|
EnableDaily *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
ServiceSettings ServiceSettings
|
ServiceSettings ServiceSettings
|
||||||
TeamSettings TeamSettings
|
TeamSettings TeamSettings
|
||||||
SqlSettings SqlSettings
|
SqlSettings SqlSettings
|
||||||
LogSettings LogSettings
|
LogSettings LogSettings
|
||||||
FileSettings FileSettings
|
FileSettings FileSettings
|
||||||
EmailSettings EmailSettings
|
EmailSettings EmailSettings
|
||||||
RateLimitSettings RateLimitSettings
|
RateLimitSettings RateLimitSettings
|
||||||
PrivacySettings PrivacySettings
|
PrivacySettings PrivacySettings
|
||||||
SupportSettings SupportSettings
|
SupportSettings SupportSettings
|
||||||
GitLabSettings SSOSettings
|
GitLabSettings SSOSettings
|
||||||
GoogleSettings SSOSettings
|
GoogleSettings SSOSettings
|
||||||
LdapSettings LdapSettings
|
LdapSettings LdapSettings
|
||||||
|
ComplianceSettings ComplianceSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Config) ToJson() string {
|
func (o *Config) ToJson() string {
|
||||||
@ -259,14 +293,34 @@ func (o *Config) SetDefaults() {
|
|||||||
*o.ServiceSettings.EnableInsecureOutgoingConnections = false
|
*o.ServiceSettings.EnableInsecureOutgoingConnections = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if o.ServiceSettings.EnableMultifactorAuthentication == nil {
|
||||||
|
o.ServiceSettings.EnableMultifactorAuthentication = new(bool)
|
||||||
|
*o.ServiceSettings.EnableMultifactorAuthentication = false
|
||||||
|
}
|
||||||
|
|
||||||
if o.TeamSettings.RestrictTeamNames == nil {
|
if o.TeamSettings.RestrictTeamNames == nil {
|
||||||
o.TeamSettings.RestrictTeamNames = new(bool)
|
o.TeamSettings.RestrictTeamNames = new(bool)
|
||||||
*o.TeamSettings.RestrictTeamNames = true
|
*o.TeamSettings.RestrictTeamNames = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if o.TeamSettings.EnableTeamListing == nil {
|
if o.TeamSettings.EnableCustomBrand == nil {
|
||||||
o.TeamSettings.EnableTeamListing = new(bool)
|
o.TeamSettings.EnableCustomBrand = new(bool)
|
||||||
*o.TeamSettings.EnableTeamListing = false
|
*o.TeamSettings.EnableCustomBrand = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.TeamSettings.CustomBrandText == nil {
|
||||||
|
o.TeamSettings.CustomBrandText = new(string)
|
||||||
|
*o.TeamSettings.CustomBrandText = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.TeamSettings.EnableOpenServer == nil {
|
||||||
|
o.TeamSettings.EnableOpenServer = new(bool)
|
||||||
|
*o.TeamSettings.EnableOpenServer = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.TeamSettings.RestrictDirectMessage == nil {
|
||||||
|
o.TeamSettings.RestrictDirectMessage = new(string)
|
||||||
|
*o.TeamSettings.RestrictDirectMessage = DIRECT_MESSAGE_ANY
|
||||||
}
|
}
|
||||||
|
|
||||||
if o.EmailSettings.EnableSignInWithEmail == nil {
|
if o.EmailSettings.EnableSignInWithEmail == nil {
|
||||||
@ -294,26 +348,51 @@ func (o *Config) SetDefaults() {
|
|||||||
*o.EmailSettings.PushNotificationServer = ""
|
*o.EmailSettings.PushNotificationServer = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if o.EmailSettings.PushNotificationContents == nil {
|
||||||
|
o.EmailSettings.PushNotificationContents = new(string)
|
||||||
|
*o.EmailSettings.PushNotificationContents = GENERIC_NOTIFICATION
|
||||||
|
}
|
||||||
|
|
||||||
|
if !IsSafeLink(o.SupportSettings.TermsOfServiceLink) {
|
||||||
|
o.SupportSettings.TermsOfServiceLink = nil
|
||||||
|
}
|
||||||
|
|
||||||
if o.SupportSettings.TermsOfServiceLink == nil {
|
if o.SupportSettings.TermsOfServiceLink == nil {
|
||||||
o.SupportSettings.TermsOfServiceLink = new(string)
|
o.SupportSettings.TermsOfServiceLink = new(string)
|
||||||
*o.SupportSettings.TermsOfServiceLink = "/static/help/terms.html"
|
*o.SupportSettings.TermsOfServiceLink = "/static/help/terms.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !IsSafeLink(o.SupportSettings.PrivacyPolicyLink) {
|
||||||
|
o.SupportSettings.PrivacyPolicyLink = nil
|
||||||
|
}
|
||||||
|
|
||||||
if o.SupportSettings.PrivacyPolicyLink == nil {
|
if o.SupportSettings.PrivacyPolicyLink == nil {
|
||||||
o.SupportSettings.PrivacyPolicyLink = new(string)
|
o.SupportSettings.PrivacyPolicyLink = new(string)
|
||||||
*o.SupportSettings.PrivacyPolicyLink = "/static/help/privacy.html"
|
*o.SupportSettings.PrivacyPolicyLink = "/static/help/privacy.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !IsSafeLink(o.SupportSettings.AboutLink) {
|
||||||
|
o.SupportSettings.AboutLink = nil
|
||||||
|
}
|
||||||
|
|
||||||
if o.SupportSettings.AboutLink == nil {
|
if o.SupportSettings.AboutLink == nil {
|
||||||
o.SupportSettings.AboutLink = new(string)
|
o.SupportSettings.AboutLink = new(string)
|
||||||
*o.SupportSettings.AboutLink = "/static/help/about.html"
|
*o.SupportSettings.AboutLink = "/static/help/about.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !IsSafeLink(o.SupportSettings.HelpLink) {
|
||||||
|
o.SupportSettings.HelpLink = nil
|
||||||
|
}
|
||||||
|
|
||||||
if o.SupportSettings.HelpLink == nil {
|
if o.SupportSettings.HelpLink == nil {
|
||||||
o.SupportSettings.HelpLink = new(string)
|
o.SupportSettings.HelpLink = new(string)
|
||||||
*o.SupportSettings.HelpLink = "/static/help/help.html"
|
*o.SupportSettings.HelpLink = "/static/help/help.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !IsSafeLink(o.SupportSettings.ReportAProblemLink) {
|
||||||
|
o.SupportSettings.ReportAProblemLink = nil
|
||||||
|
}
|
||||||
|
|
||||||
if o.SupportSettings.ReportAProblemLink == nil {
|
if o.SupportSettings.ReportAProblemLink == nil {
|
||||||
o.SupportSettings.ReportAProblemLink = new(string)
|
o.SupportSettings.ReportAProblemLink = new(string)
|
||||||
*o.SupportSettings.ReportAProblemLink = "/static/help/report_problem.html"
|
*o.SupportSettings.ReportAProblemLink = "/static/help/report_problem.html"
|
||||||
@ -339,6 +418,16 @@ func (o *Config) SetDefaults() {
|
|||||||
*o.LdapSettings.Enable = false
|
*o.LdapSettings.Enable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if o.LdapSettings.UserFilter == nil {
|
||||||
|
o.LdapSettings.UserFilter = new(string)
|
||||||
|
*o.LdapSettings.UserFilter = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.LdapSettings.LoginFieldName == nil {
|
||||||
|
o.LdapSettings.LoginFieldName = new(string)
|
||||||
|
*o.LdapSettings.LoginFieldName = ""
|
||||||
|
}
|
||||||
|
|
||||||
if o.ServiceSettings.SessionLengthWebInDays == nil {
|
if o.ServiceSettings.SessionLengthWebInDays == nil {
|
||||||
o.ServiceSettings.SessionLengthWebInDays = new(int)
|
o.ServiceSettings.SessionLengthWebInDays = new(int)
|
||||||
*o.ServiceSettings.SessionLengthWebInDays = 30
|
*o.ServiceSettings.SessionLengthWebInDays = 30
|
||||||
@ -383,6 +472,41 @@ func (o *Config) SetDefaults() {
|
|||||||
o.ServiceSettings.AllowCorsFrom = new(string)
|
o.ServiceSettings.AllowCorsFrom = new(string)
|
||||||
*o.ServiceSettings.AllowCorsFrom = ""
|
*o.ServiceSettings.AllowCorsFrom = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if o.ServiceSettings.WebserverMode == nil {
|
||||||
|
o.ServiceSettings.WebserverMode = new(string)
|
||||||
|
*o.ServiceSettings.WebserverMode = "regular"
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.ComplianceSettings.Enable == nil {
|
||||||
|
o.ComplianceSettings.Enable = new(bool)
|
||||||
|
*o.ComplianceSettings.Enable = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.ComplianceSettings.Directory == nil {
|
||||||
|
o.ComplianceSettings.Directory = new(string)
|
||||||
|
*o.ComplianceSettings.Directory = "./data/"
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.ComplianceSettings.EnableDaily == nil {
|
||||||
|
o.ComplianceSettings.EnableDaily = new(bool)
|
||||||
|
*o.ComplianceSettings.EnableDaily = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.LdapSettings.ConnectionSecurity == nil {
|
||||||
|
o.LdapSettings.ConnectionSecurity = new(string)
|
||||||
|
*o.LdapSettings.ConnectionSecurity = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.LdapSettings.SkipCertificateVerification == nil {
|
||||||
|
o.LdapSettings.SkipCertificateVerification = new(bool)
|
||||||
|
*o.LdapSettings.SkipCertificateVerification = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.LdapSettings.NicknameAttribute == nil {
|
||||||
|
o.LdapSettings.NicknameAttribute = new(string)
|
||||||
|
*o.LdapSettings.NicknameAttribute = ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Config) IsValid() *AppError {
|
func (o *Config) IsValid() *AppError {
|
||||||
@ -399,6 +523,10 @@ func (o *Config) IsValid() *AppError {
|
|||||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.max_users.app_error", nil, "")
|
return NewLocAppError("Config.IsValid", "model.config.is_valid.max_users.app_error", nil, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !(*o.TeamSettings.RestrictDirectMessage == DIRECT_MESSAGE_ANY || *o.TeamSettings.RestrictDirectMessage == DIRECT_MESSAGE_TEAM) {
|
||||||
|
return NewLocAppError("Config.IsValid", "model.config.is_valid.restrict_direct_message.app_error", nil, "")
|
||||||
|
}
|
||||||
|
|
||||||
if len(o.SqlSettings.AtRestEncryptKey) < 32 {
|
if len(o.SqlSettings.AtRestEncryptKey) < 32 {
|
||||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.encrypt_sql.app_error", nil, "")
|
return NewLocAppError("Config.IsValid", "model.config.is_valid.encrypt_sql.app_error", nil, "")
|
||||||
}
|
}
|
||||||
@ -471,13 +599,45 @@ func (o *Config) IsValid() *AppError {
|
|||||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.rate_sec.app_error", nil, "")
|
return NewLocAppError("Config.IsValid", "model.config.is_valid.rate_sec.app_error", nil, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !(*o.LdapSettings.ConnectionSecurity == CONN_SECURITY_NONE || *o.LdapSettings.ConnectionSecurity == CONN_SECURITY_TLS || *o.LdapSettings.ConnectionSecurity == CONN_SECURITY_STARTTLS) {
|
||||||
|
return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_security.app_error", nil, "")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me *Config) GetSanitizeOptions() map[string]bool {
|
func (o *Config) GetSanitizeOptions() map[string]bool {
|
||||||
options := map[string]bool{}
|
options := map[string]bool{}
|
||||||
options["fullname"] = me.PrivacySettings.ShowFullName
|
options["fullname"] = o.PrivacySettings.ShowFullName
|
||||||
options["email"] = me.PrivacySettings.ShowEmailAddress
|
options["email"] = o.PrivacySettings.ShowEmailAddress
|
||||||
|
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *Config) Sanitize() {
|
||||||
|
if &o.LdapSettings != nil && len(*o.LdapSettings.BindPassword) > 0 {
|
||||||
|
*o.LdapSettings.BindPassword = FAKE_SETTING
|
||||||
|
}
|
||||||
|
|
||||||
|
o.FileSettings.PublicLinkSalt = FAKE_SETTING
|
||||||
|
if len(o.FileSettings.AmazonS3SecretAccessKey) > 0 {
|
||||||
|
o.FileSettings.AmazonS3SecretAccessKey = FAKE_SETTING
|
||||||
|
}
|
||||||
|
|
||||||
|
o.EmailSettings.InviteSalt = FAKE_SETTING
|
||||||
|
o.EmailSettings.PasswordResetSalt = FAKE_SETTING
|
||||||
|
if len(o.EmailSettings.SMTPPassword) > 0 {
|
||||||
|
o.EmailSettings.SMTPPassword = FAKE_SETTING
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(o.GitLabSettings.Secret) > 0 {
|
||||||
|
o.GitLabSettings.Secret = FAKE_SETTING
|
||||||
|
}
|
||||||
|
|
||||||
|
o.SqlSettings.DataSource = FAKE_SETTING
|
||||||
|
o.SqlSettings.AtRestEncryptKey = FAKE_SETTING
|
||||||
|
|
||||||
|
for i := range o.SqlSettings.DataSourceReplicas {
|
||||||
|
o.SqlSettings.DataSourceReplicas[i] = FAKE_SETTING
|
||||||
|
}
|
||||||
|
}
|
||||||
|
13
vendor/github.com/mattermost/platform/model/gitlab/gitlab.go
generated
vendored
13
vendor/github.com/mattermost/platform/model/gitlab/gitlab.go
generated
vendored
@ -12,10 +12,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
USER_AUTH_SERVICE_GITLAB = "gitlab"
|
|
||||||
)
|
|
||||||
|
|
||||||
type GitLabProvider struct {
|
type GitLabProvider struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +25,7 @@ type GitLabUser struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
provider := &GitLabProvider{}
|
provider := &GitLabProvider{}
|
||||||
einterfaces.RegisterOauthProvider(USER_AUTH_SERVICE_GITLAB, provider)
|
einterfaces.RegisterOauthProvider(model.USER_AUTH_SERVICE_GITLAB, provider)
|
||||||
}
|
}
|
||||||
|
|
||||||
func userFromGitLabUser(glu *GitLabUser) *model.User {
|
func userFromGitLabUser(glu *GitLabUser) *model.User {
|
||||||
@ -49,9 +45,10 @@ func userFromGitLabUser(glu *GitLabUser) *model.User {
|
|||||||
} else {
|
} else {
|
||||||
user.FirstName = glu.Name
|
user.FirstName = glu.Name
|
||||||
}
|
}
|
||||||
|
strings.TrimSpace(user.Email)
|
||||||
user.Email = glu.Email
|
user.Email = glu.Email
|
||||||
user.AuthData = strconv.FormatInt(glu.Id, 10)
|
*user.AuthData = strconv.FormatInt(glu.Id, 10)
|
||||||
user.AuthService = USER_AUTH_SERVICE_GITLAB
|
user.AuthService = model.USER_AUTH_SERVICE_GITLAB
|
||||||
|
|
||||||
return user
|
return user
|
||||||
}
|
}
|
||||||
@ -84,7 +81,7 @@ func (glu *GitLabUser) getAuthData() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *GitLabProvider) GetIdentifier() string {
|
func (m *GitLabProvider) GetIdentifier() string {
|
||||||
return USER_AUTH_SERVICE_GITLAB
|
return model.USER_AUTH_SERVICE_GITLAB
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GitLabProvider) GetUserFromJson(data io.Reader) *model.User {
|
func (m *GitLabProvider) GetUserFromJson(data io.Reader) *model.User {
|
||||||
|
24
vendor/github.com/mattermost/platform/model/incoming_webhook.go
generated
vendored
24
vendor/github.com/mattermost/platform/model/incoming_webhook.go
generated
vendored
@ -14,13 +14,15 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type IncomingWebhook struct {
|
type IncomingWebhook struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
CreateAt int64 `json:"create_at"`
|
CreateAt int64 `json:"create_at"`
|
||||||
UpdateAt int64 `json:"update_at"`
|
UpdateAt int64 `json:"update_at"`
|
||||||
DeleteAt int64 `json:"delete_at"`
|
DeleteAt int64 `json:"delete_at"`
|
||||||
UserId string `json:"user_id"`
|
UserId string `json:"user_id"`
|
||||||
ChannelId string `json:"channel_id"`
|
ChannelId string `json:"channel_id"`
|
||||||
TeamId string `json:"team_id"`
|
TeamId string `json:"team_id"`
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type IncomingWebhookRequest struct {
|
type IncomingWebhookRequest struct {
|
||||||
@ -99,6 +101,14 @@ func (o *IncomingWebhook) IsValid() *AppError {
|
|||||||
return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.team_id.app_error", nil, "")
|
return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.team_id.app_error", nil, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(o.DisplayName) > 64 {
|
||||||
|
return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.display_name.app_error", nil, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(o.Description) > 128 {
|
||||||
|
return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.description.app_error", nil, "")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
vendor/github.com/mattermost/platform/model/license.go
generated
vendored
18
vendor/github.com/mattermost/platform/model/license.go
generated
vendored
@ -34,7 +34,10 @@ type Customer struct {
|
|||||||
type Features struct {
|
type Features struct {
|
||||||
Users *int `json:"users"`
|
Users *int `json:"users"`
|
||||||
LDAP *bool `json:"ldap"`
|
LDAP *bool `json:"ldap"`
|
||||||
|
MFA *bool `json:"mfa"`
|
||||||
GoogleSSO *bool `json:"google_sso"`
|
GoogleSSO *bool `json:"google_sso"`
|
||||||
|
Compliance *bool `json:"compliance"`
|
||||||
|
CustomBrand *bool `json:"custom_brand"`
|
||||||
MHPNS *bool `json:"mhpns"`
|
MHPNS *bool `json:"mhpns"`
|
||||||
FutureFeatures *bool `json:"future_features"`
|
FutureFeatures *bool `json:"future_features"`
|
||||||
}
|
}
|
||||||
@ -55,11 +58,26 @@ func (f *Features) SetDefaults() {
|
|||||||
*f.LDAP = *f.FutureFeatures
|
*f.LDAP = *f.FutureFeatures
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if f.MFA == nil {
|
||||||
|
f.MFA = new(bool)
|
||||||
|
*f.MFA = *f.FutureFeatures
|
||||||
|
}
|
||||||
|
|
||||||
if f.GoogleSSO == nil {
|
if f.GoogleSSO == nil {
|
||||||
f.GoogleSSO = new(bool)
|
f.GoogleSSO = new(bool)
|
||||||
*f.GoogleSSO = *f.FutureFeatures
|
*f.GoogleSSO = *f.FutureFeatures
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if f.Compliance == nil {
|
||||||
|
f.Compliance = new(bool)
|
||||||
|
*f.Compliance = *f.FutureFeatures
|
||||||
|
}
|
||||||
|
|
||||||
|
if f.CustomBrand == nil {
|
||||||
|
f.CustomBrand = new(bool)
|
||||||
|
*f.CustomBrand = *f.FutureFeatures
|
||||||
|
}
|
||||||
|
|
||||||
if f.MHPNS == nil {
|
if f.MHPNS == nil {
|
||||||
f.MHPNS = new(bool)
|
f.MHPNS = new(bool)
|
||||||
*f.MHPNS = *f.FutureFeatures
|
*f.MHPNS = *f.FutureFeatures
|
||||||
|
2
vendor/github.com/mattermost/platform/model/message.go
generated
vendored
2
vendor/github.com/mattermost/platform/model/message.go
generated
vendored
@ -13,7 +13,9 @@ const (
|
|||||||
ACTION_POSTED = "posted"
|
ACTION_POSTED = "posted"
|
||||||
ACTION_POST_EDITED = "post_edited"
|
ACTION_POST_EDITED = "post_edited"
|
||||||
ACTION_POST_DELETED = "post_deleted"
|
ACTION_POST_DELETED = "post_deleted"
|
||||||
|
ACTION_CHANNEL_DELETED = "channel_deleted"
|
||||||
ACTION_CHANNEL_VIEWED = "channel_viewed"
|
ACTION_CHANNEL_VIEWED = "channel_viewed"
|
||||||
|
ACTION_DIRECT_ADDED = "direct_added"
|
||||||
ACTION_NEW_USER = "new_user"
|
ACTION_NEW_USER = "new_user"
|
||||||
ACTION_USER_ADDED = "user_added"
|
ACTION_USER_ADDED = "user_added"
|
||||||
ACTION_USER_REMOVED = "user_removed"
|
ACTION_USER_REMOVED = "user_removed"
|
||||||
|
18
vendor/github.com/mattermost/platform/model/outgoing_webhook.go
generated
vendored
18
vendor/github.com/mattermost/platform/model/outgoing_webhook.go
generated
vendored
@ -20,6 +20,8 @@ type OutgoingWebhook struct {
|
|||||||
TeamId string `json:"team_id"`
|
TeamId string `json:"team_id"`
|
||||||
TriggerWords StringArray `json:"trigger_words"`
|
TriggerWords StringArray `json:"trigger_words"`
|
||||||
CallbackURLs StringArray `json:"callback_urls"`
|
CallbackURLs StringArray `json:"callback_urls"`
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OutgoingWebhook) ToJson() string {
|
func (o *OutgoingWebhook) ToJson() string {
|
||||||
@ -96,6 +98,14 @@ func (o *OutgoingWebhook) IsValid() *AppError {
|
|||||||
return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.words.app_error", nil, "")
|
return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.words.app_error", nil, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(o.TriggerWords) != 0 {
|
||||||
|
for _, triggerWord := range o.TriggerWords {
|
||||||
|
if len(triggerWord) == 0 {
|
||||||
|
return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.trigger_words.app_error", nil, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(o.CallbackURLs) == 0 || len(fmt.Sprintf("%s", o.CallbackURLs)) > 1024 {
|
if len(o.CallbackURLs) == 0 || len(fmt.Sprintf("%s", o.CallbackURLs)) > 1024 {
|
||||||
return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.callback.app_error", nil, "")
|
return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.callback.app_error", nil, "")
|
||||||
}
|
}
|
||||||
@ -106,6 +116,14 @@ func (o *OutgoingWebhook) IsValid() *AppError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(o.DisplayName) > 64 {
|
||||||
|
return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.display_name.app_error", nil, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(o.Description) > 128 {
|
||||||
|
return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.description.app_error", nil, "")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
vendor/github.com/mattermost/platform/model/post.go
generated
vendored
1
vendor/github.com/mattermost/platform/model/post.go
generated
vendored
@ -16,6 +16,7 @@ const (
|
|||||||
POST_SYSTEM_GENERIC = "system_generic"
|
POST_SYSTEM_GENERIC = "system_generic"
|
||||||
POST_JOIN_LEAVE = "system_join_leave"
|
POST_JOIN_LEAVE = "system_join_leave"
|
||||||
POST_HEADER_CHANGE = "system_header_change"
|
POST_HEADER_CHANGE = "system_header_change"
|
||||||
|
POST_CHANNEL_DELETED = "system_channel_deleted"
|
||||||
POST_EPHEMERAL = "system_ephemeral"
|
POST_EPHEMERAL = "system_ephemeral"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
7
vendor/github.com/mattermost/platform/model/push_notification.go
generated
vendored
7
vendor/github.com/mattermost/platform/model/push_notification.go
generated
vendored
@ -11,7 +11,10 @@ import (
|
|||||||
const (
|
const (
|
||||||
PUSH_NOTIFY_APPLE = "apple"
|
PUSH_NOTIFY_APPLE = "apple"
|
||||||
PUSH_NOTIFY_ANDROID = "android"
|
PUSH_NOTIFY_ANDROID = "android"
|
||||||
MHPNS = "https://push.mattermost.com"
|
|
||||||
|
CATEGORY_DM = "DIRECT_MESSAGE"
|
||||||
|
|
||||||
|
MHPNS = "https://push.mattermost.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PushNotification struct {
|
type PushNotification struct {
|
||||||
@ -23,6 +26,8 @@ type PushNotification struct {
|
|||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Badge int `json:"badge"`
|
Badge int `json:"badge"`
|
||||||
ContentAvailable int `json:"cont_ava"`
|
ContentAvailable int `json:"cont_ava"`
|
||||||
|
ChannelId string `json:"channel_id"`
|
||||||
|
ChannelName string `json:"channel_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me *PushNotification) ToJson() string {
|
func (me *PushNotification) ToJson() string {
|
||||||
|
1
vendor/github.com/mattermost/platform/model/search_params.go
generated
vendored
1
vendor/github.com/mattermost/platform/model/search_params.go
generated
vendored
@ -12,6 +12,7 @@ type SearchParams struct {
|
|||||||
IsHashtag bool
|
IsHashtag bool
|
||||||
InChannels []string
|
InChannels []string
|
||||||
FromUsers []string
|
FromUsers []string
|
||||||
|
OrTerms bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var searchFlags = [...]string{"from", "channel", "in"}
|
var searchFlags = [...]string{"from", "channel", "in"}
|
||||||
|
34
vendor/github.com/mattermost/platform/model/session.go
generated
vendored
34
vendor/github.com/mattermost/platform/model/session.go
generated
vendored
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SESSION_COOKIE_TOKEN = "MMTOKEN"
|
SESSION_COOKIE_TOKEN = "MMAUTHTOKEN"
|
||||||
SESSION_CACHE_SIZE = 10000
|
SESSION_CACHE_SIZE = 10000
|
||||||
SESSION_PROP_PLATFORM = "platform"
|
SESSION_PROP_PLATFORM = "platform"
|
||||||
SESSION_PROP_OS = "os"
|
SESSION_PROP_OS = "os"
|
||||||
@ -17,17 +17,17 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Session struct {
|
type Session struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
CreateAt int64 `json:"create_at"`
|
CreateAt int64 `json:"create_at"`
|
||||||
ExpiresAt int64 `json:"expires_at"`
|
ExpiresAt int64 `json:"expires_at"`
|
||||||
LastActivityAt int64 `json:"last_activity_at"`
|
LastActivityAt int64 `json:"last_activity_at"`
|
||||||
UserId string `json:"user_id"`
|
UserId string `json:"user_id"`
|
||||||
TeamId string `json:"team_id"`
|
DeviceId string `json:"device_id"`
|
||||||
DeviceId string `json:"device_id"`
|
Roles string `json:"roles"`
|
||||||
Roles string `json:"roles"`
|
IsOAuth bool `json:"is_oauth"`
|
||||||
IsOAuth bool `json:"is_oauth"`
|
Props StringMap `json:"props"`
|
||||||
Props StringMap `json:"props"`
|
TeamMembers []*TeamMember `json:"team_members" db:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me *Session) ToJson() string {
|
func (me *Session) ToJson() string {
|
||||||
@ -95,6 +95,16 @@ func (me *Session) AddProp(key string, value string) {
|
|||||||
me.Props[key] = value
|
me.Props[key] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (me *Session) GetTeamByTeamId(teamId string) *TeamMember {
|
||||||
|
for _, team := range me.TeamMembers {
|
||||||
|
if team.TeamId == teamId {
|
||||||
|
return team
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func SessionsToJson(o []*Session) string {
|
func SessionsToJson(o []*Session) string {
|
||||||
if b, err := json.Marshal(o); err != nil {
|
if b, err := json.Marshal(o); err != nil {
|
||||||
return "[]"
|
return "[]"
|
||||||
|
9
vendor/github.com/mattermost/platform/model/system.go
generated
vendored
9
vendor/github.com/mattermost/platform/model/system.go
generated
vendored
@ -9,10 +9,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SYSTEM_DIAGNOSTIC_ID = "DiagnosticId"
|
SYSTEM_DIAGNOSTIC_ID = "DiagnosticId"
|
||||||
SYSTEM_RAN_UNIT_TESTS = "RanUnitTests"
|
SYSTEM_RAN_UNIT_TESTS = "RanUnitTests"
|
||||||
SYSTEM_LAST_SECURITY_TIME = "LastSecurityTime"
|
SYSTEM_LAST_SECURITY_TIME = "LastSecurityTime"
|
||||||
SYSTEM_ACTIVE_LICENSE_ID = "ActiveLicenseId"
|
SYSTEM_ACTIVE_LICENSE_ID = "ActiveLicenseId"
|
||||||
|
SYSTEM_LAST_COMPLIANCE_TIME = "LastComplianceTime"
|
||||||
)
|
)
|
||||||
|
|
||||||
type System struct {
|
type System struct {
|
||||||
|
34
vendor/github.com/mattermost/platform/model/team.go
generated
vendored
34
vendor/github.com/mattermost/platform/model/team.go
generated
vendored
@ -18,19 +18,18 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Team struct {
|
type Team struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
CreateAt int64 `json:"create_at"`
|
CreateAt int64 `json:"create_at"`
|
||||||
UpdateAt int64 `json:"update_at"`
|
UpdateAt int64 `json:"update_at"`
|
||||||
DeleteAt int64 `json:"delete_at"`
|
DeleteAt int64 `json:"delete_at"`
|
||||||
DisplayName string `json:"display_name"`
|
DisplayName string `json:"display_name"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
CompanyName string `json:"company_name"`
|
CompanyName string `json:"company_name"`
|
||||||
AllowedDomains string `json:"allowed_domains"`
|
AllowedDomains string `json:"allowed_domains"`
|
||||||
InviteId string `json:"invite_id"`
|
InviteId string `json:"invite_id"`
|
||||||
AllowOpenInvite bool `json:"allow_open_invite"`
|
AllowOpenInvite bool `json:"allow_open_invite"`
|
||||||
AllowTeamListing bool `json:"allow_team_listing"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Invites struct {
|
type Invites struct {
|
||||||
@ -232,3 +231,12 @@ func (o *Team) Sanitize() {
|
|||||||
o.Email = ""
|
o.Email = ""
|
||||||
o.AllowedDomains = ""
|
o.AllowedDomains = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *Team) SanitizeForNotLoggedIn() {
|
||||||
|
o.Email = ""
|
||||||
|
o.AllowedDomains = ""
|
||||||
|
o.CompanyName = ""
|
||||||
|
if !o.AllowOpenInvite {
|
||||||
|
o.InviteId = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
103
vendor/github.com/mattermost/platform/model/user.go
generated
vendored
103
vendor/github.com/mattermost/platform/model/user.go
generated
vendored
@ -15,17 +15,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ROLE_TEAM_ADMIN = "admin"
|
ROLE_SYSTEM_ADMIN = "system_admin"
|
||||||
ROLE_SYSTEM_ADMIN = "system_admin"
|
USER_AWAY_TIMEOUT = 5 * 60 * 1000 // 5 minutes
|
||||||
USER_AWAY_TIMEOUT = 5 * 60 * 1000 // 5 minutes
|
USER_OFFLINE_TIMEOUT = 1 * 60 * 1000 // 1 minute
|
||||||
USER_OFFLINE_TIMEOUT = 1 * 60 * 1000 // 1 minute
|
USER_OFFLINE = "offline"
|
||||||
USER_OFFLINE = "offline"
|
USER_AWAY = "away"
|
||||||
USER_AWAY = "away"
|
USER_ONLINE = "online"
|
||||||
USER_ONLINE = "online"
|
USER_NOTIFY_ALL = "all"
|
||||||
USER_NOTIFY_ALL = "all"
|
USER_NOTIFY_MENTION = "mention"
|
||||||
USER_NOTIFY_MENTION = "mention"
|
USER_NOTIFY_NONE = "none"
|
||||||
USER_NOTIFY_NONE = "none"
|
DEFAULT_LOCALE = "en"
|
||||||
DEFAULT_LOCALE = "en"
|
USER_AUTH_SERVICE_EMAIL = "email"
|
||||||
|
USER_AUTH_SERVICE_USERNAME = "username"
|
||||||
|
MIN_PASSWORD_LENGTH = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
@ -33,10 +35,9 @@ type User struct {
|
|||||||
CreateAt int64 `json:"create_at,omitempty"`
|
CreateAt int64 `json:"create_at,omitempty"`
|
||||||
UpdateAt int64 `json:"update_at,omitempty"`
|
UpdateAt int64 `json:"update_at,omitempty"`
|
||||||
DeleteAt int64 `json:"delete_at"`
|
DeleteAt int64 `json:"delete_at"`
|
||||||
TeamId string `json:"team_id"`
|
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Password string `json:"password,omitempty"`
|
Password string `json:"password,omitempty"`
|
||||||
AuthData string `json:"auth_data,omitempty"`
|
AuthData *string `json:"auth_data,omitempty"`
|
||||||
AuthService string `json:"auth_service"`
|
AuthService string `json:"auth_service"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
EmailVerified bool `json:"email_verified,omitempty"`
|
EmailVerified bool `json:"email_verified,omitempty"`
|
||||||
@ -54,6 +55,8 @@ type User struct {
|
|||||||
LastPictureUpdate int64 `json:"last_picture_update,omitempty"`
|
LastPictureUpdate int64 `json:"last_picture_update,omitempty"`
|
||||||
FailedAttempts int `json:"failed_attempts,omitempty"`
|
FailedAttempts int `json:"failed_attempts,omitempty"`
|
||||||
Locale string `json:"locale"`
|
Locale string `json:"locale"`
|
||||||
|
MfaActive bool `json:"mfa_active,omitempty"`
|
||||||
|
MfaSecret string `json:"mfa_secret,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsValid validates the user and returns an error if it isn't configured
|
// IsValid validates the user and returns an error if it isn't configured
|
||||||
@ -72,10 +75,6 @@ func (u *User) IsValid() *AppError {
|
|||||||
return NewLocAppError("User.IsValid", "model.user.is_valid.update_at.app_error", nil, "user_id="+u.Id)
|
return NewLocAppError("User.IsValid", "model.user.is_valid.update_at.app_error", nil, "user_id="+u.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(u.TeamId) != 26 {
|
|
||||||
return NewLocAppError("User.IsValid", "model.user.is_valid.team_id.app_error", nil, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
if !IsValidUsername(u.Username) {
|
if !IsValidUsername(u.Username) {
|
||||||
return NewLocAppError("User.IsValid", "model.user.is_valid.username.app_error", nil, "user_id="+u.Id)
|
return NewLocAppError("User.IsValid", "model.user.is_valid.username.app_error", nil, "user_id="+u.Id)
|
||||||
}
|
}
|
||||||
@ -100,15 +99,15 @@ func (u *User) IsValid() *AppError {
|
|||||||
return NewLocAppError("User.IsValid", "model.user.is_valid.pwd.app_error", nil, "user_id="+u.Id)
|
return NewLocAppError("User.IsValid", "model.user.is_valid.pwd.app_error", nil, "user_id="+u.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(u.AuthData) > 128 {
|
if u.AuthData != nil && len(*u.AuthData) > 128 {
|
||||||
return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data.app_error", nil, "user_id="+u.Id)
|
return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data.app_error", nil, "user_id="+u.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(u.AuthData) > 0 && len(u.AuthService) == 0 {
|
if u.AuthData != nil && len(*u.AuthData) > 0 && len(u.AuthService) == 0 {
|
||||||
return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data_type.app_error", nil, "user_id="+u.Id)
|
return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data_type.app_error", nil, "user_id="+u.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(u.Password) > 0 && len(u.AuthData) > 0 {
|
if len(u.Password) > 0 && u.AuthData != nil && len(*u.AuthData) > 0 {
|
||||||
return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data_pwd.app_error", nil, "user_id="+u.Id)
|
return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data_pwd.app_error", nil, "user_id="+u.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,6 +130,10 @@ func (u *User) PreSave() {
|
|||||||
u.Username = NewId()
|
u.Username = NewId()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if u.AuthData != nil && *u.AuthData == "" {
|
||||||
|
u.AuthData = nil
|
||||||
|
}
|
||||||
|
|
||||||
u.Username = strings.ToLower(u.Username)
|
u.Username = strings.ToLower(u.Username)
|
||||||
u.Email = strings.ToLower(u.Email)
|
u.Email = strings.ToLower(u.Email)
|
||||||
u.Locale = strings.ToLower(u.Locale)
|
u.Locale = strings.ToLower(u.Locale)
|
||||||
@ -140,6 +143,8 @@ func (u *User) PreSave() {
|
|||||||
|
|
||||||
u.LastPasswordUpdate = u.CreateAt
|
u.LastPasswordUpdate = u.CreateAt
|
||||||
|
|
||||||
|
u.MfaActive = false
|
||||||
|
|
||||||
if u.Locale == "" {
|
if u.Locale == "" {
|
||||||
u.Locale = DEFAULT_LOCALE
|
u.Locale = DEFAULT_LOCALE
|
||||||
}
|
}
|
||||||
@ -164,6 +169,10 @@ func (u *User) PreUpdate() {
|
|||||||
u.Locale = strings.ToLower(u.Locale)
|
u.Locale = strings.ToLower(u.Locale)
|
||||||
u.UpdateAt = GetMillis()
|
u.UpdateAt = GetMillis()
|
||||||
|
|
||||||
|
if u.AuthData != nil && *u.AuthData == "" {
|
||||||
|
u.AuthData = nil
|
||||||
|
}
|
||||||
|
|
||||||
if u.NotifyProps == nil || len(u.NotifyProps) == 0 {
|
if u.NotifyProps == nil || len(u.NotifyProps) == 0 {
|
||||||
u.SetDefaultNotifications()
|
u.SetDefaultNotifications()
|
||||||
} else if _, ok := u.NotifyProps["mention_keys"]; ok {
|
} else if _, ok := u.NotifyProps["mention_keys"]; ok {
|
||||||
@ -185,13 +194,28 @@ func (u *User) SetDefaultNotifications() {
|
|||||||
u.NotifyProps["desktop"] = USER_NOTIFY_ALL
|
u.NotifyProps["desktop"] = USER_NOTIFY_ALL
|
||||||
u.NotifyProps["desktop_sound"] = "true"
|
u.NotifyProps["desktop_sound"] = "true"
|
||||||
u.NotifyProps["mention_keys"] = u.Username + ",@" + u.Username
|
u.NotifyProps["mention_keys"] = u.Username + ",@" + u.Username
|
||||||
u.NotifyProps["first_name"] = "false"
|
|
||||||
u.NotifyProps["all"] = "true"
|
u.NotifyProps["all"] = "true"
|
||||||
u.NotifyProps["channel"] = "true"
|
u.NotifyProps["channel"] = "true"
|
||||||
splitName := strings.Split(u.Nickname, " ")
|
|
||||||
if len(splitName) > 0 && splitName[0] != "" {
|
if u.FirstName == "" {
|
||||||
|
u.NotifyProps["first_name"] = "false"
|
||||||
|
} else {
|
||||||
u.NotifyProps["first_name"] = "true"
|
u.NotifyProps["first_name"] = "true"
|
||||||
u.NotifyProps["mention_keys"] += "," + splitName[0]
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (user *User) UpdateMentionKeysFromUsername(oldUsername string) {
|
||||||
|
nonUsernameKeys := []string{}
|
||||||
|
splitKeys := strings.Split(user.NotifyProps["mention_keys"], ",")
|
||||||
|
for _, key := range splitKeys {
|
||||||
|
if key != oldUsername && key != "@"+oldUsername {
|
||||||
|
nonUsernameKeys = append(nonUsernameKeys, key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
user.NotifyProps["mention_keys"] = user.Username + ",@" + user.Username
|
||||||
|
if len(nonUsernameKeys) > 0 {
|
||||||
|
user.NotifyProps["mention_keys"] += "," + strings.Join(nonUsernameKeys, ",")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +245,9 @@ func (u *User) IsAway() bool {
|
|||||||
// Remove any private data from the user object
|
// Remove any private data from the user object
|
||||||
func (u *User) Sanitize(options map[string]bool) {
|
func (u *User) Sanitize(options map[string]bool) {
|
||||||
u.Password = ""
|
u.Password = ""
|
||||||
u.AuthData = ""
|
u.AuthData = new(string)
|
||||||
|
*u.AuthData = ""
|
||||||
|
u.MfaSecret = ""
|
||||||
|
|
||||||
if len(options) != 0 && !options["email"] {
|
if len(options) != 0 && !options["email"] {
|
||||||
u.Email = ""
|
u.Email = ""
|
||||||
@ -238,8 +264,11 @@ func (u *User) Sanitize(options map[string]bool) {
|
|||||||
func (u *User) ClearNonProfileFields() {
|
func (u *User) ClearNonProfileFields() {
|
||||||
u.UpdateAt = 0
|
u.UpdateAt = 0
|
||||||
u.Password = ""
|
u.Password = ""
|
||||||
u.AuthData = ""
|
u.AuthData = new(string)
|
||||||
|
*u.AuthData = ""
|
||||||
u.AuthService = ""
|
u.AuthService = ""
|
||||||
|
u.MfaActive = false
|
||||||
|
u.MfaSecret = ""
|
||||||
u.EmailVerified = false
|
u.EmailVerified = false
|
||||||
u.LastPingAt = 0
|
u.LastPingAt = 0
|
||||||
u.AllowMarketing = false
|
u.AllowMarketing = false
|
||||||
@ -295,7 +324,7 @@ func (u *User) GetDisplayName() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsValidRoles(userRoles string) bool {
|
func IsValidUserRoles(userRoles string) bool {
|
||||||
|
|
||||||
roles := strings.Split(userRoles, " ")
|
roles := strings.Split(userRoles, " ")
|
||||||
|
|
||||||
@ -313,10 +342,6 @@ func isValidRole(role string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if role == ROLE_TEAM_ADMIN {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if role == ROLE_SYSTEM_ADMIN {
|
if role == ROLE_SYSTEM_ADMIN {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -345,8 +370,15 @@ func IsInRole(userRoles string, inRole string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *User) IsSSOUser() bool {
|
func (u *User) IsOAuthUser() bool {
|
||||||
if len(u.AuthData) != 0 && len(u.AuthService) != 0 {
|
if u.AuthService == USER_AUTH_SERVICE_GITLAB {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *User) IsLDAPUser() bool {
|
||||||
|
if u.AuthService == USER_AUTH_SERVICE_LDAP {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -354,7 +386,8 @@ func (u *User) IsSSOUser() bool {
|
|||||||
|
|
||||||
func (u *User) PreExport() {
|
func (u *User) PreExport() {
|
||||||
u.Password = ""
|
u.Password = ""
|
||||||
u.AuthData = ""
|
u.AuthData = new(string)
|
||||||
|
*u.AuthData = ""
|
||||||
u.LastActivityAt = 0
|
u.LastActivityAt = 0
|
||||||
u.LastPingAt = 0
|
u.LastPingAt = 0
|
||||||
u.LastPasswordUpdate = 0
|
u.LastPasswordUpdate = 0
|
||||||
@ -407,7 +440,7 @@ func HashPassword(password string) string {
|
|||||||
// ComparePassword compares the hash
|
// ComparePassword compares the hash
|
||||||
func ComparePassword(hash string, password string) bool {
|
func ComparePassword(hash string, password string) bool {
|
||||||
|
|
||||||
if len(password) == 0 {
|
if len(password) == 0 || len(hash) == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
65
vendor/github.com/mattermost/platform/model/utils.go
generated
vendored
65
vendor/github.com/mattermost/platform/model/utils.go
generated
vendored
@ -41,12 +41,18 @@ func (er *AppError) Error() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (er *AppError) Translate(T goi18n.TranslateFunc) {
|
func (er *AppError) Translate(T goi18n.TranslateFunc) {
|
||||||
if len(er.Message) == 0 {
|
if er.params == nil {
|
||||||
if er.params == nil {
|
er.Message = T(er.Id)
|
||||||
er.Message = T(er.Id)
|
} else {
|
||||||
} else {
|
er.Message = T(er.Id, er.params)
|
||||||
er.Message = T(er.Id, er.params)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (er *AppError) SystemMessage(T goi18n.TranslateFunc) string {
|
||||||
|
if er.params == nil {
|
||||||
|
return T(er.Id)
|
||||||
|
} else {
|
||||||
|
return T(er.Id, er.params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +81,7 @@ func NewLocAppError(where string, id string, params map[string]interface{}, deta
|
|||||||
ap := &AppError{}
|
ap := &AppError{}
|
||||||
ap.Id = id
|
ap.Id = id
|
||||||
ap.params = params
|
ap.params = params
|
||||||
|
ap.Message = id
|
||||||
ap.Where = where
|
ap.Where = where
|
||||||
ap.DetailedError = details
|
ap.DetailedError = details
|
||||||
ap.StatusCode = 500
|
ap.StatusCode = 500
|
||||||
@ -171,6 +178,26 @@ func StringInterfaceFromJson(data io.Reader) map[string]interface{} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func StringToJson(s string) string {
|
||||||
|
b, err := json.Marshal(s)
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
} else {
|
||||||
|
return string(b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func StringFromJson(data io.Reader) string {
|
||||||
|
decoder := json.NewDecoder(data)
|
||||||
|
|
||||||
|
var s string
|
||||||
|
if err := decoder.Decode(&s); err != nil {
|
||||||
|
return ""
|
||||||
|
} else {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func IsLower(s string) bool {
|
func IsLower(s string) bool {
|
||||||
if strings.ToLower(s) == s {
|
if strings.ToLower(s) == s {
|
||||||
return true
|
return true
|
||||||
@ -367,3 +394,29 @@ func IsValidHttpUrl(rawUrl string) bool {
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsValidHttpsUrl(rawUrl string) bool {
|
||||||
|
if strings.Index(rawUrl, "https://") != 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := url.ParseRequestURI(rawUrl); err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsSafeLink(link *string) bool {
|
||||||
|
if link != nil {
|
||||||
|
if IsValidHttpUrl(*link) {
|
||||||
|
return true
|
||||||
|
} else if strings.HasPrefix(*link, "/") {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
14
vendor/github.com/mattermost/platform/model/version.go
generated
vendored
14
vendor/github.com/mattermost/platform/model/version.go
generated
vendored
@ -13,6 +13,7 @@ import (
|
|||||||
// It should be maitained in chronological order with most current
|
// It should be maitained in chronological order with most current
|
||||||
// release at the front of the list.
|
// release at the front of the list.
|
||||||
var versions = []string{
|
var versions = []string{
|
||||||
|
"3.0.0",
|
||||||
"2.2.0",
|
"2.2.0",
|
||||||
"2.1.0",
|
"2.1.0",
|
||||||
"2.0.0",
|
"2.0.0",
|
||||||
@ -29,10 +30,10 @@ var versions = []string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var CurrentVersion string = versions[0]
|
var CurrentVersion string = versions[0]
|
||||||
var BuildNumber = "_BUILD_NUMBER_"
|
var BuildNumber string
|
||||||
var BuildDate = "_BUILD_DATE_"
|
var BuildDate string
|
||||||
var BuildHash = "_BUILD_HASH_"
|
var BuildHash string
|
||||||
var BuildEnterpriseReady = "_BUILD_ENTERPRISE_READY_"
|
var BuildEnterpriseReady string
|
||||||
var versionsWithoutHotFixes []string
|
var versionsWithoutHotFixes []string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -119,5 +120,10 @@ func IsPreviousVersionsSupported(versionToCheck string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Current - 3 Supported
|
||||||
|
if versionsWithoutHotFixes[3] == versionToCheckStr {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
28
vendor/manifest
vendored
28
vendor/manifest
vendored
@ -4,7 +4,8 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/42wim/matterbridge-plus/bridge",
|
"importpath": "github.com/42wim/matterbridge-plus/bridge",
|
||||||
"repository": "https://github.com/42wim/matterbridge-plus",
|
"repository": "https://github.com/42wim/matterbridge-plus",
|
||||||
"revision": "3c673e1d48339ab82788ade57394fd1b9bd4c990",
|
"vcs": "git",
|
||||||
|
"revision": "e48ce1d820967506c7ea21539f6c88f7a1377d0f",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"path": "/bridge",
|
"path": "/bridge",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -12,7 +13,8 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/42wim/matterbridge-plus/matterclient",
|
"importpath": "github.com/42wim/matterbridge-plus/matterclient",
|
||||||
"repository": "https://github.com/42wim/matterbridge-plus",
|
"repository": "https://github.com/42wim/matterbridge-plus",
|
||||||
"revision": "3c673e1d48339ab82788ade57394fd1b9bd4c990",
|
"vcs": "git",
|
||||||
|
"revision": "e48ce1d820967506c7ea21539f6c88f7a1377d0f",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"path": "/matterclient",
|
"path": "/matterclient",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -20,6 +22,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/42wim/matterbridge/matterhook",
|
"importpath": "github.com/42wim/matterbridge/matterhook",
|
||||||
"repository": "https://github.com/42wim/matterbridge",
|
"repository": "https://github.com/42wim/matterbridge",
|
||||||
|
"vcs": "",
|
||||||
"revision": "6b18257185b1830bd2eff83fae30bdd2055f78b0",
|
"revision": "6b18257185b1830bd2eff83fae30bdd2055f78b0",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"path": "/matterhook",
|
"path": "/matterhook",
|
||||||
@ -28,6 +31,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/Sirupsen/logrus",
|
"importpath": "github.com/Sirupsen/logrus",
|
||||||
"repository": "https://github.com/Sirupsen/logrus",
|
"repository": "https://github.com/Sirupsen/logrus",
|
||||||
|
"vcs": "",
|
||||||
"revision": "4b6ea7319e214d98c938f12692336f7ca9348d6b",
|
"revision": "4b6ea7319e214d98c938f12692336f7ca9348d6b",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -35,6 +39,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/alecthomas/log4go",
|
"importpath": "github.com/alecthomas/log4go",
|
||||||
"repository": "https://github.com/alecthomas/log4go",
|
"repository": "https://github.com/alecthomas/log4go",
|
||||||
|
"vcs": "",
|
||||||
"revision": "e5dc62318d9bd58682f1dceb53a4b24e8253682f",
|
"revision": "e5dc62318d9bd58682f1dceb53a4b24e8253682f",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -42,6 +47,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/gorilla/schema",
|
"importpath": "github.com/gorilla/schema",
|
||||||
"repository": "https://github.com/gorilla/schema",
|
"repository": "https://github.com/gorilla/schema",
|
||||||
|
"vcs": "",
|
||||||
"revision": "ddf016c1034e9cfd3eb5b276f626c8f04d765f6f",
|
"revision": "ddf016c1034e9cfd3eb5b276f626c8f04d765f6f",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -49,6 +55,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/gorilla/websocket",
|
"importpath": "github.com/gorilla/websocket",
|
||||||
"repository": "https://github.com/gorilla/websocket",
|
"repository": "https://github.com/gorilla/websocket",
|
||||||
|
"vcs": "",
|
||||||
"revision": "e2e3d8414d0fbae04004f151979f4e27c6747fe7",
|
"revision": "e2e3d8414d0fbae04004f151979f4e27c6747fe7",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -56,6 +63,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/jpillora/backoff",
|
"importpath": "github.com/jpillora/backoff",
|
||||||
"repository": "https://github.com/jpillora/backoff",
|
"repository": "https://github.com/jpillora/backoff",
|
||||||
|
"vcs": "",
|
||||||
"revision": "8dc7c274049d8fa405b51f6fbec11db195a977cd",
|
"revision": "8dc7c274049d8fa405b51f6fbec11db195a977cd",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -63,7 +71,8 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/mattermost/platform/einterfaces",
|
"importpath": "github.com/mattermost/platform/einterfaces",
|
||||||
"repository": "https://github.com/mattermost/platform",
|
"repository": "https://github.com/mattermost/platform",
|
||||||
"revision": "8e883ad2f516820942cc0131241268c1ea909ff3",
|
"vcs": "git",
|
||||||
|
"revision": "9d94869cc6a0fb9f051879437c104ccd76094380",
|
||||||
"branch": "HEAD",
|
"branch": "HEAD",
|
||||||
"path": "/einterfaces",
|
"path": "/einterfaces",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -71,7 +80,8 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/mattermost/platform/model",
|
"importpath": "github.com/mattermost/platform/model",
|
||||||
"repository": "https://github.com/mattermost/platform",
|
"repository": "https://github.com/mattermost/platform",
|
||||||
"revision": "8e883ad2f516820942cc0131241268c1ea909ff3",
|
"vcs": "git",
|
||||||
|
"revision": "9d94869cc6a0fb9f051879437c104ccd76094380",
|
||||||
"branch": "HEAD",
|
"branch": "HEAD",
|
||||||
"path": "/model",
|
"path": "/model",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -79,6 +89,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/nicksnyder/go-i18n/i18n",
|
"importpath": "github.com/nicksnyder/go-i18n/i18n",
|
||||||
"repository": "https://github.com/nicksnyder/go-i18n",
|
"repository": "https://github.com/nicksnyder/go-i18n",
|
||||||
|
"vcs": "",
|
||||||
"revision": "37e5c2de3e03e4b82693e3fcb4a6aa2cc4eb07e3",
|
"revision": "37e5c2de3e03e4b82693e3fcb4a6aa2cc4eb07e3",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"path": "/i18n",
|
"path": "/i18n",
|
||||||
@ -87,6 +98,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/pborman/uuid",
|
"importpath": "github.com/pborman/uuid",
|
||||||
"repository": "https://github.com/pborman/uuid",
|
"repository": "https://github.com/pborman/uuid",
|
||||||
|
"vcs": "",
|
||||||
"revision": "c55201b036063326c5b1b89ccfe45a184973d073",
|
"revision": "c55201b036063326c5b1b89ccfe45a184973d073",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -94,6 +106,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/peterhellberg/giphy",
|
"importpath": "github.com/peterhellberg/giphy",
|
||||||
"repository": "https://github.com/peterhellberg/giphy",
|
"repository": "https://github.com/peterhellberg/giphy",
|
||||||
|
"vcs": "",
|
||||||
"revision": "f9e0363118602c138e4d9dad66c261b15f26d31a",
|
"revision": "f9e0363118602c138e4d9dad66c261b15f26d31a",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -101,6 +114,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/sorcix/irc",
|
"importpath": "github.com/sorcix/irc",
|
||||||
"repository": "https://github.com/sorcix/irc",
|
"repository": "https://github.com/sorcix/irc",
|
||||||
|
"vcs": "",
|
||||||
"revision": "2f0c85e4ec6590c2c6f6ef93b0a86021281ea193",
|
"revision": "2f0c85e4ec6590c2c6f6ef93b0a86021281ea193",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -108,6 +122,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/thoj/go-ircevent",
|
"importpath": "github.com/thoj/go-ircevent",
|
||||||
"repository": "https://github.com/thoj/go-ircevent",
|
"repository": "https://github.com/thoj/go-ircevent",
|
||||||
|
"vcs": "",
|
||||||
"revision": "da78ed515c0f0833e7a92c7cc52898176198e2c1",
|
"revision": "da78ed515c0f0833e7a92c7cc52898176198e2c1",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -115,6 +130,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "golang.org/x/crypto/bcrypt",
|
"importpath": "golang.org/x/crypto/bcrypt",
|
||||||
"repository": "https://go.googlesource.com/crypto",
|
"repository": "https://go.googlesource.com/crypto",
|
||||||
|
"vcs": "",
|
||||||
"revision": "3fbbcd23f1cb824e69491a5930cfeff09b12f4d2",
|
"revision": "3fbbcd23f1cb824e69491a5930cfeff09b12f4d2",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"path": "/bcrypt",
|
"path": "/bcrypt",
|
||||||
@ -123,6 +139,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "golang.org/x/crypto/blowfish",
|
"importpath": "golang.org/x/crypto/blowfish",
|
||||||
"repository": "https://go.googlesource.com/crypto",
|
"repository": "https://go.googlesource.com/crypto",
|
||||||
|
"vcs": "",
|
||||||
"revision": "3fbbcd23f1cb824e69491a5930cfeff09b12f4d2",
|
"revision": "3fbbcd23f1cb824e69491a5930cfeff09b12f4d2",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"path": "/blowfish",
|
"path": "/blowfish",
|
||||||
@ -131,6 +148,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "golang.org/x/net/http2/hpack",
|
"importpath": "golang.org/x/net/http2/hpack",
|
||||||
"repository": "https://go.googlesource.com/net",
|
"repository": "https://go.googlesource.com/net",
|
||||||
|
"vcs": "",
|
||||||
"revision": "e45385e9b226f570b1f086bf287b25d3d4117776",
|
"revision": "e45385e9b226f570b1f086bf287b25d3d4117776",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"path": "/http2/hpack",
|
"path": "/http2/hpack",
|
||||||
@ -139,6 +157,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "gopkg.in/gcfg.v1",
|
"importpath": "gopkg.in/gcfg.v1",
|
||||||
"repository": "https://gopkg.in/gcfg.v1",
|
"repository": "https://gopkg.in/gcfg.v1",
|
||||||
|
"vcs": "",
|
||||||
"revision": "083575c3955c85df16fe9590cceab64d03f5eb6e",
|
"revision": "083575c3955c85df16fe9590cceab64d03f5eb6e",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
@ -146,6 +165,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "gopkg.in/yaml.v2",
|
"importpath": "gopkg.in/yaml.v2",
|
||||||
"repository": "https://gopkg.in/yaml.v2",
|
"repository": "https://gopkg.in/yaml.v2",
|
||||||
|
"vcs": "",
|
||||||
"revision": "a83829b6f1293c91addabc89d0571c246397bbf4",
|
"revision": "a83829b6f1293c91addabc89d0571c246397bbf4",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
|
Loading…
Reference in New Issue
Block a user