Skip to content

Commit

Permalink
Account Path in GwtSession
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Mezzasalma <[email protected]>
  • Loading branch information
Claudio Mezzasalma committed May 29, 2018
1 parent a2b26e2 commit b5e6e15
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ public void onSuccess(List<MainViewDescriptor> viewDescriptors) {
if (result != null) {
currentSession.setSelectedAccountId(result.getId());
currentSession.setSelectedAccountName(result.getName());
currentSession.setSelectedAccountPath(result.getParentAccountPath());
}

// Update userActionButtonLabel with the current data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;

import org.eclipse.kapua.KapuaException;
import org.eclipse.kapua.app.console.core.shared.model.authentication.GwtJwtCredential;
import org.eclipse.kapua.app.console.core.shared.model.authentication.GwtLoginCredential;
Expand Down Expand Up @@ -61,6 +62,7 @@
import org.eclipse.kapua.service.authorization.role.RoleService;
import org.eclipse.kapua.service.user.User;
import org.eclipse.kapua.service.user.UserService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -276,6 +278,9 @@ public Account call() throws Exception {
gwtSession.setRootAccountName(gwtAccount.getName());
gwtSession.setSelectedAccountName(gwtAccount.getName());

gwtSession.setAccountPath(gwtAccount.getParentAccountPath());
gwtSession.setSelectedAccountPath(gwtAccount.getParentAccountPath());

//
// Load permissions
KapuaSecurityUtils.doPrivileged(new ThrowingRunnable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.List;

import com.google.gwt.user.client.rpc.IsSerializable;

import org.eclipse.kapua.app.console.module.api.shared.model.GwtUpdatableEntityModel;

public class GwtAccount extends GwtUpdatableEntityModel implements Serializable {
Expand Down Expand Up @@ -98,6 +99,14 @@ public String getParentAccountId() {
return (String) get("parentAccountId");
}

public String getParentAccountPath() {
return get("parentAccountPath");
}

public void setParentAccountPath(String parentAccountPath) {
set("parentAccountPath", parentAccountPath);
}

public List<GwtAccount> getChildAccounts() {
return get("childAccounts");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public static GwtAccount convertAccount(Account account) {
gwtAccount.setName(account.getName());
gwtAccount.setGwtOrganization(convertOrganization(account.getOrganization()));
gwtAccount.setParentAccountId(account.getScopeId() != null ? account.getScopeId().toCompactId() : null);
gwtAccount.setParentAccountPath(account.getParentAccountPath());
gwtAccount.setOptlock(account.getOptlock());
gwtAccount.set("orgName", account.getOrganization().getName());
gwtAccount.set("orgEmail", account.getOrganization().getEmail());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ public class GwtSession extends KapuaBaseModel implements Serializable {

// User info
private String accountId;
private String accountPath;
private String rootAccountId;
private String rootAccountName;

private String selectedAccountId;
private String selectedAccountName;
private String selectedAccountPath;

private String userId;
private String userName;
Expand Down Expand Up @@ -92,6 +94,14 @@ public void setAccountId(String accountId) {
this.accountId = accountId;
}

public String getAccountPath() {
return accountPath;
}

public void setAccountPath(String accountPath) {
this.accountPath = accountPath;
}

public void setRootAccountId(String rootAccountId) {
this.rootAccountId = rootAccountId;
}
Expand All @@ -108,6 +118,14 @@ public String getSelectedAccountId() {
return selectedAccountId;
}

public String getSelectedAccountPath() {
return selectedAccountPath;
}

public void setSelectedAccountPath(String selectedAccountPath) {
this.selectedAccountPath = selectedAccountPath;
}

public String getUserName() {
return userName;
}
Expand Down

0 comments on commit b5e6e15

Please sign in to comment.