|
|
|
@ -14,9 +14,13 @@ import org.gcube.portlets.user.gcubeloggedin.shared.VObject.UserBelongingClient;
|
|
|
|
|
import org.gcube.portlets.user.gcubeloggedin.shared.VREClient;
|
|
|
|
|
import org.gcube.portlets.user.gcubewidgets.server.ScopeServiceImpl;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.RoleManager;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
|
|
|
@ -33,6 +37,7 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
|
|
|
|
public class LoggedinServiceImpl extends RemoteServiceServlet implements LoggedinService {
|
|
|
|
|
|
|
|
|
|
private static final Logger _log = LoggerFactory.getLogger(LoggedinServiceImpl.class);
|
|
|
|
|
private static final String VRE_MANAGER_ROLE = "VRE-Manager";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* the current ASLSession
|
|
|
|
@ -110,9 +115,26 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
return new VREClient(name, "", desc, logoURL, "", UserBelongingClient.BELONGING, false, false, isCurrUserVREManager());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO: implement this through UM
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean isCurrUserVREManager() {
|
|
|
|
|
return true;
|
|
|
|
|
ASLSession session = getASLSession();
|
|
|
|
|
long userId;
|
|
|
|
|
try {
|
|
|
|
|
userId = new LiferayUserManager().getUserId(session.getUsername());
|
|
|
|
|
long groupId = new LiferayGroupManager().getGroupIdFromInfrastructureScope(session.getScope());
|
|
|
|
|
RoleManager rm = new LiferayRoleManager();
|
|
|
|
|
long roleId = rm.getRoleIdByName(VRE_MANAGER_ROLE);
|
|
|
|
|
boolean toReturn = rm.hasRole(userId, groupId, roleId);
|
|
|
|
|
_log.debug("User " + session.getUsername() + " is " + VRE_MANAGER_ROLE + " for " + session.getScope() + "? -> " + toReturn);
|
|
|
|
|
return toReturn;
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected static ArrayList<String> getAdministratorsEmails(String scope) {
|
|
|
|
|