forked from mattermost/mattermost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MM 57516 - deactivate actions to ldap users (mattermost#28199)
* MM-57516 - restrict activation/deactivation over ldap users * Add unit tests * refactor test to unify repeated actions * add disable actions in user details too * migrate test to use react-testing-library * add new ldap user test and fix other existing tests * restrict ldap users status management via api * use correct server status and update tests --------- Co-authored-by: Mattermost Build <[email protected]>
- Loading branch information
1 parent
ac38f5f
commit 6cafd45
Showing
10 changed files
with
1,360 additions
and
798 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2684,6 +2684,31 @@ func TestUpdateUserActive(t *testing.T) { | |
require.NoError(t, err) | ||
}) | ||
}) | ||
|
||
t.Run("update active status of LDAP user should fail", func(t *testing.T) { | ||
th := Setup(t).InitBasic() | ||
defer th.TearDown() | ||
|
||
ldapUser := &model.User{ | ||
Email: "[email protected]", | ||
Username: "ldapuser", | ||
Password: "Password123", | ||
AuthService: model.UserAuthServiceLdap, | ||
EmailVerified: true, | ||
} | ||
user, appErr := th.App.CreateUser(th.Context, ldapUser) | ||
require.Nil(t, appErr) | ||
|
||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { | ||
resp, err := client.UpdateUserActive(context.Background(), user.Id, false) | ||
require.Error(t, err) | ||
CheckForbiddenStatus(t, resp) | ||
|
||
resp, err = client.UpdateUserActive(context.Background(), user.Id, true) | ||
require.Error(t, err) | ||
CheckForbiddenStatus(t, resp) | ||
}) | ||
}) | ||
} | ||
|
||
func TestGetUsers(t *testing.T) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.