Restore a few missing fields on appsmith.user object (#7295)

With latest update, the following fields are unavailable on the `appsmith.user` object:

- `accountNonExpired`
- `accountNonLocked`
- `credentialsNonExpired`
- `isAnonymous`
- `isEnabled`

These fields are necessary for building applications and many apps were relying on these, despite them not being listed in the documentation at <https://docs.appsmith.com/framework-reference/appsmith#user>.
This commit is contained in:
Shrikant Sharat Kandula 2021-09-09 15:34:02 +05:30 committed by GitHub
parent f18d58bb12
commit 9b98621010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package com.appsmith.server.dtos;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.Set;
@ -17,6 +18,24 @@ public class UserProfileDTO {
String gender;
@JsonProperty(value = "isAnonymous")
boolean isAnonymous;
@JsonProperty(value = "isEnabled")
boolean isEnabled;
boolean isEmptyInstance = false;
public boolean isAccountNonExpired() {
return this.isEnabled;
}
public boolean isAccountNonLocked() {
return this.isEnabled;
}
public boolean isCredentialsNonExpired() {
return this.isEnabled;
}
}

View File

@ -865,6 +865,8 @@ public class UserServiceImpl extends BaseService<UserRepository, User, String> i
profile.setName(user.getName());
profile.setGender(user.getGender());
profile.setEmptyInstance(isUsersEmpty);
profile.setAnonymous(user.isAnonymous());
profile.setEnabled(user.isEnabled());
return profile;
});

View File

@ -101,4 +101,4 @@ In this UI, you can manage your application's process. You should stop applicati
## Troubleshooting
If at any time you encounter an error during the installation process, reach out to **support@appsmith.com** or join our [Discord Server](https://discord.com/invite/rBTTVJp)
If you know the error and would like to reinstall Appsmith, simply delete the installation folder and the templates folder and execute the script again
If you know the error and would like to reinstall Appsmith, simply delete the installation folder and the templates folder and execute the script again