[MM-28536] [MM-28535] sysconsole_write_authentication bug fixes (#15558)

* MM-28536 User with write-auth should be able to use all saml related endpoints

* MM-28535 allow users with write auth to invalidate pending email invites

* Update api4/team_test.go

* No need for init basic

* Address review comments

* Fix test ordering
Этот коммит содержится в:
Farhan Munshi
2020-09-24 11:26:11 -04:00
коммит произвёл GitHub
родитель 4ef44a3ba1
Коммит 2af1bb7579
3 изменённых файлов: 43 добавлений и 18 удалений

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

@@ -3351,3 +3351,28 @@ func TestTeamMembersMinusGroupMembers(t *testing.T) {
})
}
}
func TestInvalidateAllEmailInvites(t *testing.T) {
th := Setup(t)
defer th.TearDown()
t.Run("Forbidden when request performed by system user", func(t *testing.T) {
ok, res := th.Client.InvalidateEmailInvites()
require.Equal(t, false, ok)
CheckForbiddenStatus(t, res)
})
t.Run("OK when request performed by system user with requisite system permission", func(t *testing.T) {
th.AddPermissionToRole(model.PERMISSION_SYSCONSOLE_WRITE_AUTHENTICATION.Id, model.SYSTEM_USER_ROLE_ID)
defer th.RemovePermissionFromRole(model.PERMISSION_SYSCONSOLE_WRITE_AUTHENTICATION.Id, model.SYSTEM_USER_ROLE_ID)
ok, res := th.Client.InvalidateEmailInvites()
require.Equal(t, true, ok)
CheckOKStatus(t, res)
})
t.Run("OK when request performed by system admin", func(t *testing.T) {
ok, res := th.SystemAdminClient.InvalidateEmailInvites()
require.Equal(t, true, ok)
CheckOKStatus(t, res)
})
}