[9.4.x] Users: Fix org user always getting org id = 1 (#63759)
Users: Fix org user always getting org id = 1 on auto assign false (#63708)
* fix org user always getting org id = 1 on auto assign false
* make tests explicit
* use correct cfg in service accounts
* fix api tests
* fix database test of ac
* fix InsertOrgUser returning affected rows as orgID
(cherry picked from commit c8db771939)
This commit is contained in:
@@ -144,11 +144,11 @@ func (s *Service) Create(ctx context.Context, cmd *user.CreateUserCommand) (*use
|
||||
Updated: time.Now(),
|
||||
}
|
||||
|
||||
if setting.AutoAssignOrg && !usr.IsAdmin {
|
||||
if s.cfg.AutoAssignOrg && !usr.IsAdmin {
|
||||
if len(cmd.DefaultOrgRole) > 0 {
|
||||
orgUser.Role = org.RoleType(cmd.DefaultOrgRole)
|
||||
} else {
|
||||
orgUser.Role = org.RoleType(setting.AutoAssignOrgRole)
|
||||
orgUser.Role = org.RoleType(s.cfg.AutoAssignOrgRole)
|
||||
}
|
||||
}
|
||||
_, err = s.orgService.InsertOrgUser(ctx, &orgUser)
|
||||
|
||||
Reference in New Issue
Block a user