PLT 6125 Allow system admins to create users on closed servers (#5908)
* Update user.go Added method to create user accounts using a privileged system_admin account * Update user.go Added respective method to handle the the APIv4 call to create users with privileged account(system_admin) by passing server restrictions of EnableUserCreation and/or EnableOpenServer set to false. * Update user_test.go Added test case
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
8d36a1e96a
Коммит
8b868828bf
13
app/user.go
13
app/user.go
@@ -105,6 +105,19 @@ func CreateUserWithInviteId(user *model.User, inviteId string, siteURL string) (
|
||||
return ruser, nil
|
||||
}
|
||||
|
||||
func CreateUserAsAdmin(user *model.User, siteURL string) (*model.User, *model.AppError) {
|
||||
ruser, err := CreateUser(user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := SendWelcomeEmail(ruser.Id, ruser.Email, ruser.EmailVerified, ruser.Locale, siteURL); err != nil {
|
||||
l4g.Error(err.Error())
|
||||
}
|
||||
|
||||
return ruser, nil
|
||||
}
|
||||
|
||||
func CreateUserFromSignup(user *model.User, siteURL string) (*model.User, *model.AppError) {
|
||||
if err := IsUserSignUpAllowed(); err != nil {
|
||||
return nil, err
|
||||
|
||||
Ссылка в новой задаче
Block a user