{"record":{"id":"ec4f73ba17fc5162","repo":"apolloconfig/apollo","slug":"change-user-enabled-is-unsupported","errorCode":null,"errorMessage":"change user enabled is unsupported","messagePattern":"change user enabled is unsupported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":500,"severity":"error","filePath":"apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/UserController.java","lineNumber":132,"sourceCode":"        ((SpringSecurityUserService) userService).update(user);\n      }\n    } else {\n      throw new UnsupportedOperationException(\"Create or update user operation is unsupported\");\n    }\n    return ResponseEntity.ok().build();\n  }\n\n  @Override\n  public ResponseEntity<Void> changeUserEnabled(OpenUserDTO openUserDTO, String operator) {\n    boolean consumerRequest = requireUserManagementMutationPermission(operator);\n    if (!consumerRequest && !unifiedPermissionValidator.isSuperAdmin()) {\n      throw new AccessDeniedException(\"Change user enabled operation is forbidden\");\n    }\n    UserPO user = OpenApiModelConverters.toUserPO(openUserDTO);\n    if (userService instanceof SpringSecurityUserService) {\n      ((SpringSecurityUserService) userService).changeEnabled(user);\n    } else {\n      throw new UnsupportedOperationException(\"change user enabled is unsupported\");\n    }\n    return ResponseEntity.ok().build();\n  }\n\n  private void requirePortalUserRequest() {\n    if (!isPortalUserIdentity()) {\n      throw new AccessDeniedException(\"Portal user session is required\");\n    }\n  }\n\n  private void requireUserManagementReadPermission() {\n    if (UserIdentityConstants.USER.equals(UserIdentityContextHolder.getAuthType())) {\n      return;\n    }\n    if (UserIdentityConstants.USER_TOKEN.equals(UserIdentityContextHolder.getAuthType())\n        && unifiedPermissionValidator.hasManageUsersPermission()) {\n      return;\n    }","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/apolloconfig/apollo/blob/d95fc18d112589efc09ddcbe1507047584d55251/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/UserController.java#L114-L150","documentation":"Thrown by changeUserEnabled when the configured UserService is not SpringSecurityUserService, so local enabled-state changes are unsupported.","triggerScenarios":"Thrown when the configured user service SPI does not support enabling/disabling users.","commonSituations":"External user directory (LDAP/SSO) in use, so enabled state cannot be changed from Apollo.","solutions":["Use the built-in Spring Security user service if enabling/disabling users via API is required.","If users are managed in an external system (e.g., LDAP), change the enabled state there instead."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d95fc18d112589efc09ddcbe1507047584d55251","analyzedAt":"2026-08-14T04:00:05.477Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}