Implementing Portlet

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@113446 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2015-03-04 17:00:07 +00:00
parent 743efbb3a7
commit 414745ca17
1 changed files with 27 additions and 10 deletions

View File

@ -27,6 +27,10 @@ import com.liferay.portal.kernel.servlet.ImageServletTokenUtil;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.Organization;
import com.liferay.portal.model.User;
import com.liferay.portal.security.permission.PermissionChecker;
import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
import com.liferay.portal.security.permission.PermissionThreadLocal;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay;
@ -125,19 +129,33 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
private static final String REQUEST_BASED_GROUP = "Requestbasedgroup";
public boolean requireAccessGrant(Organization organization){
if (organization.getExpandoBridge().getAttribute(REQUEST_BASED_GROUP) == null || organization.getExpandoBridge().getAttribute(REQUEST_BASED_GROUP).equals("")) {
_log.trace("Attribute {} not initialized. In this case by default Access Grant is permitted", REQUEST_BASED_GROUP);
public boolean requireAccessGrant(Organization organization) throws PortalException, SystemException {
return true;
/*
try {
long companyId = OrganizationsUtil.getCompany().getCompanyId();
_log.trace("Setting Thread Permission");
User user = UserLocalServiceUtil.getUserByScreenName(companyId, ScopeHelper.getAdministratorUsername());
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user, false);
PermissionThreadLocal.setPermissionChecker(permissionChecker);
_log.trace("Setting Permission ok!");
if (organization.getExpandoBridge().getAttribute(REQUEST_BASED_GROUP) == null || organization.getExpandoBridge().getAttribute(REQUEST_BASED_GROUP).equals("")) {
_log.trace("Attribute {} not initialized. In this case by default Access Grant is permitted", REQUEST_BASED_GROUP);
return true;
} else {
String attributeValue = (String) organization.getExpandoBridge().getAttribute(REQUEST_BASED_GROUP);
return (attributeValue.compareTo("true") == 0);
}
} catch (Exception e) {
return true;
} else {
String attributeValue = (String) organization.getExpandoBridge().getAttribute(REQUEST_BASED_GROUP);
return (attributeValue.compareTo("true") == 0);
}
*/
}
public ArrayList<VRE> getPortalOrganizationMappedToVRE() throws SystemException, PortalException{
public ArrayList<VRE> getPortalOrganizationMappedToVRE() throws SystemException, PortalException {
List<VRE> vres = new ArrayList<VRE>();
ArrayList<VRE> vres = new ArrayList<VRE>();
List<Organization> organizations = OrganizationLocalServiceUtil.getOrganizations(0, OrganizationLocalServiceUtil.getOrganizationsCount());
Organization rootOrganization = null;
@ -181,8 +199,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
}
}
return null;
return vres;
}
public static final String ROOT_ORG = "rootorganization";