mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Check your credentials from session
This commit is contained in:
@@ -271,7 +271,7 @@ func (c *Context) IsTeamAdmin(userId string) bool {
|
||||
return false
|
||||
} else {
|
||||
user := uresult.Data.(*model.User)
|
||||
return strings.Contains(user.Roles, model.ROLE_ADMIN) && user.TeamId == c.Session.TeamId
|
||||
return strings.Contains(c.Session.Roles, model.ROLE_ADMIN) && user.TeamId == c.Session.TeamId
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func TestCreatePost(t *testing.T) {
|
||||
@@ -534,6 +535,10 @@ func TestDeletePosts(t *testing.T) {
|
||||
|
||||
Client.LoginByEmail(team.Domain, userAdmin.Email, "pwd")
|
||||
|
||||
fmt.Println(userAdmin.Email)
|
||||
fmt.Println(team.Email)
|
||||
fmt.Println(userAdmin.Roles)
|
||||
|
||||
Client.Must(Client.DeletePost(channel1.Id, post4.Id))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user