Bläddra i källkod

skip clients loop when admin

abhishek9686 10 månader sedan
förälder
incheckning
9609d87a87
1 ändrade filer med 4 tillägg och 2 borttagningar
  1. 4 2
      pro/remote_access_client.go

+ 4 - 2
pro/remote_access_client.go

@@ -43,6 +43,10 @@ func racAutoDisableHook() error {
 	currentTime := time.Now()
 	validityDuration := servercfg.GetJwtValidityDuration()
 	for _, user := range users {
+		if user.PlatformRoleID == models.AdminRole ||
+			user.PlatformRoleID == models.SuperAdminRole {
+			continue
+		}
 		if !currentTime.After(user.LastLoginTime.Add(validityDuration)) {
 			continue
 		}
@@ -51,8 +55,6 @@ func racAutoDisableHook() error {
 				continue
 			}
 			if (client.OwnerID == user.UserName) &&
-				user.PlatformRoleID != models.SuperAdminRole &&
-				user.PlatformRoleID != models.AdminRole &&
 				client.Enabled {
 				slog.Info(fmt.Sprintf("disabling ext client %s for user %s due to RAC autodisabling", client.ClientID, client.OwnerID))
 				if err := disableExtClient(&client); err != nil {