SQLStore: allow to look for is_disabled flag (#18032)
* Add support for `is_disabled` to `CreateUser()` * Add support for `is_disabled` to `SearchUsers()` Had to add it as a `string` type not as `bool`, since if that's property is omitted, we would have add it to SQL request, which might be dangerous * Restructure desctructive tests and add more
This commit is contained in:
@@ -106,6 +106,7 @@ func CreateUser(ctx context.Context, cmd *models.CreateUserCommand) error {
|
||||
Login: cmd.Login,
|
||||
Company: cmd.Company,
|
||||
IsAdmin: cmd.IsAdmin,
|
||||
IsDisabled: cmd.IsDisabled,
|
||||
OrgId: orgId,
|
||||
EmailVerified: cmd.EmailVerified,
|
||||
Created: time.Now(),
|
||||
@@ -455,6 +456,16 @@ func SearchUsers(query *models.SearchUsersQuery) error {
|
||||
whereParams = append(whereParams, queryWithWildcards, queryWithWildcards, queryWithWildcards)
|
||||
}
|
||||
|
||||
if query.IsDisabled != "" {
|
||||
param, err := strconv.ParseBool(query.IsDisabled)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
whereConditions = append(whereConditions, "is_disabled = ?")
|
||||
whereParams = append(whereParams, param)
|
||||
}
|
||||
|
||||
if query.AuthModule != "" {
|
||||
whereConditions = append(
|
||||
whereConditions,
|
||||
|
||||
Reference in New Issue
Block a user