added feature for editing VRE Text revised and completed
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gcube-loggedin@128600 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
abba2f43e5
commit
f8def6a569
|
@ -51,12 +51,13 @@ public class AboutView extends Composite {
|
|||
desc = desc.substring(0, MAX_CHAR_DESC) + " ...";
|
||||
//description.getElement().setInnerHTML(desc);
|
||||
description.setHTML(desc);
|
||||
description.addStyleName("vre-description");
|
||||
seeMore.setVisible(true);
|
||||
seeMore.setText(SEE_MORE);
|
||||
if (vobj.isManager()) {
|
||||
editButton.setVisible(true);
|
||||
}
|
||||
} else
|
||||
description.setHTML(desc);
|
||||
description.addStyleName("vre-description");
|
||||
if (vobj.isManager()) {
|
||||
editButton.setVisible(true);
|
||||
}
|
||||
mod = new EditDescriptionModal(vobj.getName(), vobj.getDescription());
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ public class EditDescriptionModal extends Composite {
|
|||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
text2Edit.setText(result);
|
||||
loading.setIcon(IconType.CHECK_SIGN);
|
||||
loading.setSpin(false);
|
||||
loadingText.setText("Saving successful, please refresh the page to see your changes.");
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue