Skip to content

Commit

Permalink
avniproject/avni-webapp#1147 - include organisation category info in …
Browse files Browse the repository at this point in the history
…web/userInfo response
  • Loading branch information
petmongrels committed May 3, 2024
1 parent 59451f3 commit 5d714c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public UserInfoWebResponse getUserInfo() {
user.getSyncSettings(),
groupPrivilegeResponses,
user.hasAllPrivileges(),
lastSessionTime);
lastSessionTime,
contextOrganisation.getCategory());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import org.avni.server.domain.JsonObject;
import org.avni.server.domain.Organisation;
import org.avni.server.domain.User;
import org.avni.server.domain.metadata.OrganisationCategory;
import org.avni.server.web.request.UserInfoContract;

import java.util.List;

public class UserInfoWebResponse extends UserInfoContract {
private OrganisationCategory organisationCategory;
private long lastSessionTime;
private boolean hasAllPrivileges;
private List<UserPrivilegeWebResponse> privileges;
Expand All @@ -27,15 +29,17 @@ public static UserInfoWebResponse createForAdminUser(List<UserPrivilegeWebRespon
response.setOrganisationId(contextOrganisation.getId());
response.setOrganisationName(contextOrganisation.getName());
response.setUsernameSuffix(contextOrganisation.getEffectiveUsernameSuffix());
response.organisationCategory = contextOrganisation.getCategory();
}
return response;
}

public UserInfoWebResponse(String username, String orgName, Long orgId, String usernameSuffix, JsonObject settings, String name, String catchmentName, JsonObject syncSettings, List<UserPrivilegeWebResponse> privileges, boolean hasAllPrivileges, long lastSessionTime) {
public UserInfoWebResponse(String username, String orgName, Long orgId, String usernameSuffix, JsonObject settings, String name, String catchmentName, JsonObject syncSettings, List<UserPrivilegeWebResponse> privileges, boolean hasAllPrivileges, long lastSessionTime, OrganisationCategory organisationCategory) {
super(username, orgName, orgId, usernameSuffix, settings, name, catchmentName, syncSettings);
this.privileges = privileges;
this.hasAllPrivileges = hasAllPrivileges;
this.lastSessionTime = lastSessionTime;
this.organisationCategory = organisationCategory;
}

public List<UserPrivilegeWebResponse> getPrivileges() {
Expand All @@ -57,4 +61,8 @@ public long getLastSessionTime() {
public void setLastSessionTime(long lastSessionTime) {
this.lastSessionTime = lastSessionTime;
}

public OrganisationCategory getOrganisationCategory() {
return organisationCategory;
}
}

0 comments on commit 5d714c7

Please sign in to comment.