mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-26 18:48:15 +02:00
parent
05c93e7529
commit
134be30dbc
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -15,7 +15,7 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
ci-ubuntu-server:
|
ci-ubuntu-server:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@ -54,7 +54,7 @@ jobs:
|
|||||||
run: cd focalboard; make server-test-${{matrix['db']}}
|
run: cd focalboard; make server-test-${{matrix['db']}}
|
||||||
|
|
||||||
ci-ubuntu-webapp:
|
ci-ubuntu-webapp:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
4
.github/workflows/dev-release.yml
vendored
4
.github/workflows/dev-release.yml
vendored
@ -14,7 +14,7 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
ubuntu:
|
ubuntu:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@ -218,7 +218,7 @@ jobs:
|
|||||||
path: ${{ github.workspace }}/focalboard/win-wpf/dist/focalboard-win.zip
|
path: ${{ github.workspace }}/focalboard/win-wpf/dist/focalboard-win.zip
|
||||||
|
|
||||||
plugin:
|
plugin:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
4
.github/workflows/lint-server.yml
vendored
4
.github/workflows/lint-server.yml
vendored
@ -13,7 +13,7 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
down-migrations:
|
down-migrations:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@ -26,7 +26,7 @@ jobs:
|
|||||||
|
|
||||||
golangci:
|
golangci:
|
||||||
name: plugin
|
name: plugin
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
|
4
.github/workflows/prod-release.yml
vendored
4
.github/workflows/prod-release.yml
vendored
@ -9,7 +9,7 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
ubuntu:
|
ubuntu:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -216,7 +216,7 @@ jobs:
|
|||||||
path: ${{ github.workspace }}/focalboard/win-wpf/dist/focalboard-win.zip
|
path: ${{ github.workspace }}/focalboard/win-wpf/dist/focalboard-win.zip
|
||||||
|
|
||||||
plugin-release:
|
plugin-release:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -184,7 +184,6 @@ func TestPatchBoard(t *testing.T) {
|
|||||||
|
|
||||||
// Type not null will retrieve team members
|
// Type not null will retrieve team members
|
||||||
th.Store.EXPECT().GetUsersByTeam(teamID, "", false, false).Return([]*model.User{}, nil)
|
th.Store.EXPECT().GetUsersByTeam(teamID, "", false, false).Return([]*model.User{}, nil)
|
||||||
th.Store.EXPECT().GetUserByID(userID).Return(&model.User{ID: userID, Username: "UserName"}, nil)
|
|
||||||
|
|
||||||
th.Store.EXPECT().PatchBoard(boardID, patch, userID).Return(
|
th.Store.EXPECT().PatchBoard(boardID, patch, userID).Return(
|
||||||
&model.Board{
|
&model.Board{
|
||||||
@ -412,8 +411,8 @@ func TestPatchBoard(t *testing.T) {
|
|||||||
TeamID: teamID,
|
TeamID: teamID,
|
||||||
IsTemplate: true,
|
IsTemplate: true,
|
||||||
}, nil).Times(1)
|
}, nil).Times(1)
|
||||||
|
|
||||||
th.API.EXPECT().HasPermissionToChannel(userID, channelID, model.PermissionCreatePost).Return(false).Times(1)
|
th.API.EXPECT().HasPermissionToChannel(userID, channelID, model.PermissionCreatePost).Return(false).Times(1)
|
||||||
|
|
||||||
_, err := th.App.PatchBoard(patch, boardID, userID)
|
_, err := th.App.PatchBoard(patch, boardID, userID)
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
})
|
})
|
||||||
@ -433,7 +432,7 @@ func TestPatchBoard(t *testing.T) {
|
|||||||
th.Store.EXPECT().GetBoard(boardID).Return(&model.Board{
|
th.Store.EXPECT().GetBoard(boardID).Return(&model.Board{
|
||||||
ID: boardID,
|
ID: boardID,
|
||||||
TeamID: teamID,
|
TeamID: teamID,
|
||||||
}, nil).Times(2)
|
}, nil).Times(1)
|
||||||
|
|
||||||
th.API.EXPECT().HasPermissionToChannel(userID, channelID, model.PermissionCreatePost).Return(true).Times(1)
|
th.API.EXPECT().HasPermissionToChannel(userID, channelID, model.PermissionCreatePost).Return(true).Times(1)
|
||||||
|
|
||||||
@ -444,6 +443,8 @@ func TestPatchBoard(t *testing.T) {
|
|||||||
},
|
},
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
|
th.Store.EXPECT().GetUserByID(userID).Return(&model.User{ID: userID, Username: "UserName"}, nil)
|
||||||
|
|
||||||
// Should call GetMembersForBoard 2 times
|
// Should call GetMembersForBoard 2 times
|
||||||
// - for WS BroadcastBoardChange
|
// - for WS BroadcastBoardChange
|
||||||
// - for AddTeamMembers check
|
// - for AddTeamMembers check
|
||||||
@ -476,11 +477,10 @@ func TestPatchBoard(t *testing.T) {
|
|||||||
TeamID: teamID,
|
TeamID: teamID,
|
||||||
IsTemplate: true,
|
IsTemplate: true,
|
||||||
ChannelID: channelID,
|
ChannelID: channelID,
|
||||||
}, nil).Times(2)
|
}, nil).Times(1)
|
||||||
|
|
||||||
th.API.EXPECT().HasPermissionToChannel(userID, channelID, model.PermissionCreatePost).Return(false).Times(1)
|
th.API.EXPECT().HasPermissionToChannel(userID, channelID, model.PermissionCreatePost).Return(false).Times(1)
|
||||||
|
|
||||||
th.API.EXPECT().HasPermissionToTeam(userID, teamID, model.PermissionManageTeam).Return(false).Times(1)
|
|
||||||
// Should call GetMembersForBoard 2 times
|
// Should call GetMembersForBoard 2 times
|
||||||
// for WS BroadcastBoardChange
|
// for WS BroadcastBoardChange
|
||||||
// for AddTeamMembers check
|
// for AddTeamMembers check
|
||||||
|
@ -5,6 +5,10 @@ package app
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/mattermost/focalboard/server/services/permissions/mmpermissions"
|
||||||
|
mmpermissionsMocks "github.com/mattermost/focalboard/server/services/permissions/mmpermissions/mocks"
|
||||||
|
permissionsMocks "github.com/mattermost/focalboard/server/services/permissions/mocks"
|
||||||
|
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
|
|
||||||
"github.com/mattermost/focalboard/server/auth"
|
"github.com/mattermost/focalboard/server/auth"
|
||||||
@ -23,6 +27,7 @@ type TestHelper struct {
|
|||||||
Store *mockstore.MockStore
|
Store *mockstore.MockStore
|
||||||
FilesBackend *mocks.FileBackend
|
FilesBackend *mocks.FileBackend
|
||||||
logger mlog.LoggerIFace
|
logger mlog.LoggerIFace
|
||||||
|
API *mmpermissionsMocks.MockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetupTestHelper(t *testing.T) (*TestHelper, func()) {
|
func SetupTestHelper(t *testing.T) (*TestHelper, func()) {
|
||||||
@ -37,6 +42,10 @@ func SetupTestHelper(t *testing.T) (*TestHelper, func()) {
|
|||||||
webhook := webhook.NewClient(&cfg, logger)
|
webhook := webhook.NewClient(&cfg, logger)
|
||||||
metricsService := metrics.NewMetrics(metrics.InstanceInfo{})
|
metricsService := metrics.NewMetrics(metrics.InstanceInfo{})
|
||||||
|
|
||||||
|
mockStore := permissionsMocks.NewMockStore(ctrl)
|
||||||
|
mockAPI := mmpermissionsMocks.NewMockAPI(ctrl)
|
||||||
|
permissions := mmpermissions.New(mockStore, mockAPI, mlog.CreateConsoleTestLogger(true, mlog.LvlError))
|
||||||
|
|
||||||
appServices := Services{
|
appServices := Services{
|
||||||
Auth: auth,
|
Auth: auth,
|
||||||
Store: store,
|
Store: store,
|
||||||
@ -45,6 +54,7 @@ func SetupTestHelper(t *testing.T) (*TestHelper, func()) {
|
|||||||
Metrics: metricsService,
|
Metrics: metricsService,
|
||||||
Logger: logger,
|
Logger: logger,
|
||||||
SkipTemplateInit: true,
|
SkipTemplateInit: true,
|
||||||
|
Permissions: permissions,
|
||||||
}
|
}
|
||||||
app2 := New(&cfg, wsserver, appServices)
|
app2 := New(&cfg, wsserver, appServices)
|
||||||
|
|
||||||
@ -60,5 +70,6 @@ func SetupTestHelper(t *testing.T) (*TestHelper, func()) {
|
|||||||
Store: store,
|
Store: store,
|
||||||
FilesBackend: filesBackend,
|
FilesBackend: filesBackend,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
API: mockAPI,
|
||||||
}, tearDown
|
}, tearDown
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
PermissionViewTeam = mmModel.PermissionViewTeam
|
PermissionViewTeam = mmModel.PermissionViewTeam
|
||||||
PermissionReadChannel = mmModel.PermissionReadChannel
|
PermissionReadChannel = mmModel.PermissionReadChannel
|
||||||
PermissionViewMembers = mmModel.PermissionViewMembers
|
PermissionViewMembers = mmModel.PermissionViewMembers
|
||||||
PermissionCreatePublicChannel = mmModel.PermissionCreatePublicChannel
|
PermissionCreatePublicChannel = mmModel.PermissionCreatePublicChannel
|
||||||
PermissionCreatePrivateChannel = mmModel.PermissionCreatePrivateChannel
|
PermissionCreatePrivateChannel = mmModel.PermissionCreatePrivateChannel
|
||||||
|
|
||||||
|
PermissionCreatePost = mmModel.PermissionCreatePost
|
||||||
|
PermissionManageTeam = mmModel.PermissionManageTeam
|
||||||
PermissionManageBoardType = &mmModel.Permission{Id: "manage_board_type", Name: "", Description: "", Scope: ""}
|
PermissionManageBoardType = &mmModel.Permission{Id: "manage_board_type", Name: "", Description: "", Scope: ""}
|
||||||
PermissionDeleteBoard = &mmModel.Permission{Id: "delete_board", Name: "", Description: "", Scope: ""}
|
PermissionDeleteBoard = &mmModel.Permission{Id: "delete_board", Name: "", Description: "", Scope: ""}
|
||||||
PermissionViewBoard = &mmModel.Permission{Id: "view_board", Name: "", Description: "", Scope: ""}
|
PermissionViewBoard = &mmModel.Permission{Id: "view_board", Name: "", Description: "", Scope: ""}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user