implementation at 30 percent
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vo-management/usermanagement-core@122932 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b0b7c1c5ac
commit
7a63712cc5
7
pom.xml
7
pom.xml
|
@ -30,6 +30,11 @@
|
|||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common.portal</groupId>
|
||||
<artifactId>portal-manager</artifactId>
|
||||
<version>[1.2.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
|
@ -99,7 +104,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
@ -8,8 +8,8 @@ import org.gcube.vomanagement.usermanagement.exception.UserManagementNameExcepti
|
|||
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.model.GroupModel;
|
||||
import org.gcube.vomanagement.usermanagement.model.RoleModel;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -18,50 +18,50 @@ import org.gcube.vomanagement.usermanagement.model.RoleModel;
|
|||
* @author Giulio Galiero
|
||||
*
|
||||
*/
|
||||
public interface GroupManager {
|
||||
public interface GroupManager {
|
||||
|
||||
//public GroupModel createGroup(String groupName, String userId) throws UserManagementException;
|
||||
// GCubeGroup createGroup(String groupName, String userId) throws UserManagementException;
|
||||
|
||||
public GroupModel createRootVO(String RootVOName, String userId, String description)throws UserManagementNameException, UserManagementSystemException, UserRetrievalFault ,GroupRetrievalFault, UserManagementPortalException;
|
||||
GCubeGroup createRootVO(String RootVOName, String userId, String description)throws UserManagementNameException, UserManagementSystemException, UserRetrievalFault ,GroupRetrievalFault, UserManagementPortalException;
|
||||
|
||||
public GroupModel createVO(String VOName, String rootVOGroupId, String userId, String description)throws UserManagementNameException, UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault, UserManagementPortalException;
|
||||
GCubeGroup createVO(String VOName, String rootVOGroupId, String userId, String description)throws UserManagementNameException, UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault, UserManagementPortalException;
|
||||
|
||||
public GroupModel createVRE(String VREName, String VOGroupId, String userId, String description)throws UserManagementNameException, UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault, UserManagementPortalException;
|
||||
GCubeGroup createVRE(String VREName, String VOGroupId, String userId, String description)throws UserManagementNameException, UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault, UserManagementPortalException;
|
||||
|
||||
public void deleteGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
void deleteGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public void updateGroup(GroupModel group) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
void updateGroup(GCubeGroup group) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public GroupModel getGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
GCubeGroup getGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public GroupModel getRootVO() throws UserManagementSystemException, GroupRetrievalFault;
|
||||
GCubeGroup getRootVO() throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public String getRootVOName() throws UserManagementSystemException, GroupRetrievalFault;
|
||||
String getRootVOName() throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public List<GroupModel> listGroups() throws UserManagementSystemException;
|
||||
List<GCubeGroup> listGroups() throws UserManagementSystemException;
|
||||
|
||||
public List<GroupModel> listGroupsByUser(String userId) throws UserManagementSystemException;
|
||||
List<GCubeGroup> listGroupsByUser(String userId) throws UserManagementSystemException;
|
||||
|
||||
public List<GroupModel> listPendingGroupsByUser(String userId) throws UserManagementSystemException;
|
||||
List<GCubeGroup> listPendingGroupsByUser(String userId) throws UserManagementSystemException;
|
||||
|
||||
public List<GroupModel> listSubGroupsByGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
List<GCubeGroup> listSubGroupsByGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public HashMap<String, List<RoleModel>> listGroupsAndRolesByUser(String userId) throws UserManagementSystemException;
|
||||
HashMap<String, List<GCubeRole>> listGroupsAndRolesByUser(String userId) throws UserManagementSystemException;
|
||||
|
||||
public void assignSubGrouptoParentGroup(String subGroupId, String parentGroupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
void assignSubGrouptoParentGroup(String subGroupId, String parentGroupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public void dismissSubGroupFromParentGroup(String subGroupId, String parentGroupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
void dismissSubGroupFromParentGroup(String subGroupId, String parentGroupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public String getGroupId(String groupName) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
String getGroupId(String groupName) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public long getGroupParentId(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
long getGroupParentId(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public String getScope(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
String getScope(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public Boolean isRootVO(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
Boolean isRootVO(long groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public Boolean isVO(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
Boolean isVO(long groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
public Boolean isVRE(String groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
Boolean isVRE(long groupId) throws UserManagementSystemException, GroupRetrievalFault;
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.gcube.vomanagement.usermanagement.exception.UserManagementIOException
|
|||
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.model.RoleModel;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
||||
|
||||
/**
|
||||
* This interface defines the manager class that manages the roles.
|
||||
|
@ -33,7 +33,7 @@ public interface RoleManager {
|
|||
|
||||
public void dismissRoleFromUser(String groupId, String roleId, String userId)throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault,RoleRetrievalFault;
|
||||
|
||||
public RoleModel getRole(String roleId) throws UserManagementSystemException, RoleRetrievalFault;
|
||||
public GCubeRole getRole(String roleId) throws UserManagementSystemException, RoleRetrievalFault;
|
||||
|
||||
public String getRoleId(String roleName, String groupName) throws UserManagementSystemException;
|
||||
|
||||
|
@ -42,13 +42,13 @@ public interface RoleManager {
|
|||
@Deprecated
|
||||
public List<String> listRoles() throws UserManagementSystemException;
|
||||
|
||||
public List<RoleModel> listAllRoles() throws UserManagementSystemException;
|
||||
public List<GCubeRole> listAllRoles() throws UserManagementSystemException;
|
||||
|
||||
public List<RoleModel> listRolesByGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault, UserManagementFileNotFoundException, UserManagementIOException;
|
||||
public List<GCubeRole> listRolesByGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault, UserManagementFileNotFoundException, UserManagementIOException;
|
||||
|
||||
public List<RoleModel> listRolesByUser(String userId) throws UserManagementSystemException;
|
||||
public List<GCubeRole> listRolesByUser(String userId) throws UserManagementSystemException;
|
||||
|
||||
public List<RoleModel> listRolesByUserAndGroup(String groupId, String userId) throws UserManagementSystemException, GroupRetrievalFault,UserRetrievalFault ;
|
||||
public List<GCubeRole> listRolesByUserAndGroup(String groupId, String userId) throws UserManagementSystemException, GroupRetrievalFault,UserRetrievalFault ;
|
||||
|
||||
public void updateRole(String initialRoleName, String newRoleName, String roleDescription, String groupName) throws UserManagementSystemException, RoleRetrievalFault, NumberFormatException, UserManagementFileNotFoundException, UserManagementIOException, GroupRetrievalFault,UserManagementPortalException;
|
||||
|
||||
|
|
|
@ -2,15 +2,19 @@ package org.gcube.vomanagement.usermanagement;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.exception.RoleRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.model.GroupModel;
|
||||
import org.gcube.vomanagement.usermanagement.model.RoleModel;
|
||||
import org.gcube.vomanagement.usermanagement.model.UserModel;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeMembershipRequest;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.gcube.vomanagement.usermanagement.model.MembershipRequestStatus;
|
||||
|
||||
import com.liferay.portal.model.MembershipRequest;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -27,7 +31,7 @@ import org.gcube.vomanagement.usermanagement.model.UserModel;
|
|||
* @throws UserManagementSystemException
|
||||
* @throws UserRetrievalFault
|
||||
*/
|
||||
UserModel getUserByUsername(String username) throws UserManagementSystemException, UserRetrievalFault ;
|
||||
GCubeUser getUserByUsername(String username) throws UserManagementSystemException, UserRetrievalFault ;
|
||||
/**
|
||||
*
|
||||
* @param username the email of the user you want to get
|
||||
|
@ -35,13 +39,21 @@ import org.gcube.vomanagement.usermanagement.model.UserModel;
|
|||
* @throws UserManagementSystemException
|
||||
* @throws UserRetrievalFault
|
||||
*/
|
||||
UserModel getUserByEmail(String email) throws UserManagementSystemException, UserRetrievalFault;
|
||||
GCubeUser getUserByEmail(String email) throws UserManagementSystemException, UserRetrievalFault;
|
||||
/**
|
||||
*
|
||||
* @param username the LR screenname
|
||||
* @return the LR userId associated to this screenname
|
||||
* @throws UserManagementSystemException
|
||||
* @throws UserRetrievalFault
|
||||
*/
|
||||
long getUserId(String username) throws UserManagementSystemException, UserRetrievalFault;
|
||||
/**
|
||||
*
|
||||
* @return a list of all portal active users no matter if the belong or not to a VRE, if a user is deactived is not returned
|
||||
* @throws UserManagementSystemException
|
||||
*/
|
||||
List<UserModel> listUsers() throws UserManagementSystemException;
|
||||
List<GCubeUser> listUsers() throws UserManagementSystemException;
|
||||
/**
|
||||
*
|
||||
* @param groupId the LR groupId
|
||||
|
@ -50,7 +62,7 @@ import org.gcube.vomanagement.usermanagement.model.UserModel;
|
|||
* @throws GroupRetrievalFault
|
||||
* @throws UserRetrievalFault
|
||||
*/
|
||||
List<UserModel> listUsersByGroup(long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
List<GCubeUser> listUsersByGroup(long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
/**
|
||||
*
|
||||
* @param the name of the VO or VRE (e.g. devVRE, or gcube etc.)
|
||||
|
@ -59,31 +71,92 @@ import org.gcube.vomanagement.usermanagement.model.UserModel;
|
|||
* @throws GroupRetrievalFault
|
||||
* @throws UserRetrievalFault
|
||||
*/
|
||||
List<UserModel> listUsersByGroupName(String name) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
|
||||
List<UserModel> listPendingUsersByGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
List<GCubeUser> listUsersByGroupName(String name) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
/**
|
||||
*
|
||||
* @param groupId the LR groupId
|
||||
* @return the list of {@link MembershipRequest} with their status and users given the LR GroupId (status can be requested, approved or rejected, @see {@link MembershipRequestStatus}
|
||||
* @throws UserManagementSystemException
|
||||
* @throws GroupRetrievalFault
|
||||
* @throws UserRetrievalFault
|
||||
*/
|
||||
List<GCubeMembershipRequest> listMembershipRequestsByGroup(long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
/**
|
||||
* request the membership to a restricted Site, no further actions are performed (no emails are sent, nor notifications)
|
||||
* @param userId the LR userid
|
||||
* @param groupId the LR groupId the
|
||||
* @param comment a comment to the request must not be null
|
||||
* @throws UserManagementSystemException
|
||||
* @throws GroupRetrievalFault
|
||||
* @throws UserRetrievalFault
|
||||
*/
|
||||
GCubeMembershipRequest requestMembership(long userId, long groupId, String comment) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
/**
|
||||
* accept a membership request and optionally add the user to the group
|
||||
* @param requestUserId the LR userid of the request
|
||||
* @param groupId the LR groupId
|
||||
* @param addUserToGroup if you want it to also add the user to the group
|
||||
* @param String the username (screenname) of the user accepting the request
|
||||
* @param replyComment a comment attachd to the reply (must not be null)
|
||||
* @throws UserManagementSystemException
|
||||
* @throws GroupRetrievalFault
|
||||
* @throws UserManagementPortalException
|
||||
*/
|
||||
GCubeMembershipRequest acceptMembershipRequest(long requestUserId,long groupId, boolean addUserToGroup, String replyUsername, String replyComment) throws UserManagementSystemException, GroupRetrievalFault, UserManagementPortalException;
|
||||
/**
|
||||
* rejects a membership request
|
||||
* @param requestUserId the LR userid of the request
|
||||
* @param groupId the LR groupId
|
||||
* @param String the username (screenname) of the user accepting the request
|
||||
* @param replyComment a comment attachd to the reply (must not be null)
|
||||
* @throws UserManagementSystemException
|
||||
* @throws GroupRetrievalFault
|
||||
* @throws UserManagementPortalException
|
||||
*/
|
||||
GCubeMembershipRequest rejectMembershipRequest(long userId, long groupId, String replyUsername, String replyComment) throws UserManagementSystemException, GroupRetrievalFault, UserManagementPortalException;
|
||||
/**
|
||||
*
|
||||
* @param groupId the LR groupId
|
||||
* @return the list of {@link GCubeUser} with their GCubeRole given the LR GroupId
|
||||
* @throws GroupRetrievalFault
|
||||
* @throws UserManagementSystemException
|
||||
* @throws UserRetrievalFault
|
||||
*/
|
||||
Map<GCubeUser, List<GCubeRole>> listUsersAndRolesByGroup(long groupId) throws GroupRetrievalFault, UserManagementSystemException, UserRetrievalFault ;
|
||||
/**
|
||||
*
|
||||
* @param groupId the LR groupId
|
||||
* @parmam roleId the LR roleId
|
||||
* @return the list of {@link GCubeUser} having group and role that matches
|
||||
* @throws GroupRetrievalFault
|
||||
* @throws UserManagementSystemException
|
||||
* @throws UserRetrievalFault
|
||||
*/
|
||||
List<GCubeUser> listUsersByGroupAndRole(long groupId, long roleId) throws UserManagementSystemException, RoleRetrievalFault, GroupRetrievalFault, UserRetrievalFault;
|
||||
/**
|
||||
* this method assigns the user to the Group and perform other necessary actions (such as adding him to the HL Folder)
|
||||
* @param groupId LR groupId
|
||||
* @param userId LR userId
|
||||
* @throws UserManagementSystemException
|
||||
* @throws GroupRetrievalFault
|
||||
* @throws UserRetrievalFault
|
||||
* @throws UserManagementPortalException
|
||||
*/
|
||||
void assignUserToGroup(long groupId, long userId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault, UserManagementPortalException;
|
||||
/**
|
||||
* this method removes the user to the Group and perform other necessary actions (such as removing him from the HL Folder)
|
||||
* @param groupId LR groupId
|
||||
* @param userId LR userId
|
||||
* @throws UserManagementSystemException
|
||||
* @throws GroupRetrievalFault
|
||||
* @throws UserRetrievalFault
|
||||
* @throws UserManagementPortalException
|
||||
*/
|
||||
void dismissUserFromGroup(long groupId, long userId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
|
||||
String getMembershipRequestComment(String userId, String groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
List<GCubeUser> listUnregisteredUsersByGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
|
||||
HashMap<UserModel, List<RoleModel>> listUsersAndRolesByGroup(String groupId) throws GroupRetrievalFault, UserManagementSystemException, UserRetrievalFault ;
|
||||
|
||||
HashMap<UserModel, List<GroupModel>> listUsersAndGroupsByRole(String roleId) throws UserManagementSystemException, RoleRetrievalFault, UserRetrievalFault ;
|
||||
|
||||
List<UserModel> listUsersByGroupAndRole(String groupId, String roleId) throws UserManagementSystemException, RoleRetrievalFault, GroupRetrievalFault, UserRetrievalFault;
|
||||
|
||||
void assignUserToGroup(String groupId, String userId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault, UserManagementPortalException;
|
||||
|
||||
void dismissUserFromGroup(String groupId, String userId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
|
||||
void requestMembership(String userId, String groupId, String comment) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
|
||||
List<UserModel> listUnregisteredUsersByGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault;
|
||||
|
||||
Long getUserId(String screenName) throws UserManagementSystemException;
|
||||
|
||||
List<UserModel> getMembershipRequests(String groupId) throws UserManagementSystemException,GroupRetrievalFault, UserRetrievalFault;
|
||||
|
||||
HashMap<String, String> getUserCustomAttributes(String userId) throws UserManagementSystemException, UserRetrievalFault;
|
||||
Map<String, String> getUserCustomAttributes(String userId) throws UserManagementSystemException, UserRetrievalFault;
|
||||
|
||||
void setUserCustomAttributes(String userId, HashMap<String,String> hMap) throws UserManagementSystemException, UserRetrievalFault, UserManagementPortalException;
|
||||
|
||||
|
@ -91,5 +164,5 @@ import org.gcube.vomanagement.usermanagement.model.UserModel;
|
|||
|
||||
void setUserCustomAttributeByName(String userId, String attrName, String attrValue) throws UserManagementSystemException, UserRetrievalFault, UserManagementPortalException;
|
||||
|
||||
void denyMembershipRequest(String userId,String groupId)throws UserManagementSystemException, GroupRetrievalFault, UserManagementPortalException;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
package org.gcube.vomanagement.usermanagement.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementNameException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
||||
|
||||
import com.liferay.portal.kernel.exception.PortalException;
|
||||
import com.liferay.portal.model.Group;
|
||||
import com.liferay.portal.service.GroupLocalServiceUtil;
|
||||
|
||||
public class LiferayGroupManager implements GroupManager {
|
||||
|
||||
@Override
|
||||
public GCubeGroup createRootVO(String RootVOName, String userId,
|
||||
String description) throws UserManagementNameException,
|
||||
UserManagementSystemException, UserRetrievalFault,
|
||||
GroupRetrievalFault, UserManagementPortalException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GCubeGroup createVO(String VOName, String rootVOGroupId,
|
||||
String userId, String description)
|
||||
throws UserManagementNameException, UserManagementSystemException,
|
||||
UserRetrievalFault, GroupRetrievalFault,
|
||||
UserManagementPortalException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GCubeGroup createVRE(String VREName, String VOGroupId,
|
||||
String userId, String description)
|
||||
throws UserManagementNameException, UserManagementSystemException,
|
||||
UserRetrievalFault, GroupRetrievalFault,
|
||||
UserManagementPortalException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGroup(String groupId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGroup(GCubeGroup group)
|
||||
throws UserManagementSystemException, GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public GCubeGroup getGroup(String groupId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GCubeGroup getRootVO() throws UserManagementSystemException,
|
||||
GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRootVOName() throws UserManagementSystemException,
|
||||
GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GCubeGroup> listGroups() throws UserManagementSystemException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GCubeGroup> listGroupsByUser(String userId)
|
||||
throws UserManagementSystemException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GCubeGroup> listPendingGroupsByUser(String userId)
|
||||
throws UserManagementSystemException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GCubeGroup> listSubGroupsByGroup(String groupId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, List<GCubeRole>> listGroupsAndRolesByUser(
|
||||
String userId) throws UserManagementSystemException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignSubGrouptoParentGroup(String subGroupId,
|
||||
String parentGroupId) throws UserManagementSystemException,
|
||||
GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismissSubGroupFromParentGroup(String subGroupId,
|
||||
String parentGroupId) throws UserManagementSystemException,
|
||||
GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupId(String groupName)
|
||||
throws UserManagementSystemException, GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGroupParentId(String groupId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScope(String groupId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isRootVO(long groupId) throws UserManagementSystemException, GroupRetrievalFault {
|
||||
try {
|
||||
Group g = GroupLocalServiceUtil.getGroup(groupId);
|
||||
return (g.getParentGroup() == null);
|
||||
} catch (PortalException e1) {
|
||||
throw new GroupRetrievalFault("Group not existing (I think you better check)", e1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isVO(long groupId) throws UserManagementSystemException, GroupRetrievalFault {
|
||||
try {
|
||||
Group g = GroupLocalServiceUtil.getGroup(groupId);
|
||||
if (g.getParentGroup() != null) {
|
||||
return !isVRE(groupId);
|
||||
}
|
||||
} catch (PortalException e1) {
|
||||
throw new GroupRetrievalFault("Group not existing (I think you better check)", e1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isVRE(long groupId) throws UserManagementSystemException, GroupRetrievalFault {
|
||||
try {
|
||||
Group g = GroupLocalServiceUtil.getGroup(groupId);
|
||||
if (g.getParentGroup() != null) {
|
||||
return (g.getParentGroup().getParentGroup() != null);
|
||||
}
|
||||
} catch (PortalException e1) {
|
||||
throw new GroupRetrievalFault("Group not existing (I think you better check)", e1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,9 +1,14 @@
|
|||
package org.gcube.vomanagement.usermanagement.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.exception.RoleRetrievalFault;
|
||||
|
@ -11,9 +16,11 @@ import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalExcep
|
|||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.model.Email;
|
||||
import org.gcube.vomanagement.usermanagement.model.GroupModel;
|
||||
import org.gcube.vomanagement.usermanagement.model.RoleModel;
|
||||
import org.gcube.vomanagement.usermanagement.model.UserModel;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeMembershipRequest;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.gcube.vomanagement.usermanagement.model.MembershipRequestStatus;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -24,9 +31,18 @@ import com.liferay.portal.kernel.util.PropsUtil;
|
|||
import com.liferay.portal.model.Company;
|
||||
import com.liferay.portal.model.EmailAddress;
|
||||
import com.liferay.portal.model.Group;
|
||||
import com.liferay.portal.model.MembershipRequest;
|
||||
import com.liferay.portal.model.Role;
|
||||
import com.liferay.portal.model.User;
|
||||
import com.liferay.portal.security.auth.PrincipalThreadLocal;
|
||||
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.CompanyLocalServiceUtil;
|
||||
import com.liferay.portal.service.GroupLocalServiceUtil;
|
||||
import com.liferay.portal.service.MembershipRequestLocalServiceUtil;
|
||||
import com.liferay.portal.service.RoleServiceUtil;
|
||||
import com.liferay.portal.service.ServiceContext;
|
||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||
import com.liferay.portlet.sites.util.SitesUtil;
|
||||
|
||||
|
@ -38,7 +54,8 @@ public class LiferayUserManager implements UserManager {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public static final String DEFAULT_COMPANY_WEB_ID = "liferay.com";
|
||||
private static final String DEFAULT_COMPANY_WEB_ID = "liferay.com";
|
||||
|
||||
|
||||
public static Company getCompany() throws PortalException, SystemException {
|
||||
return CompanyLocalServiceUtil.getCompanyByWebId(getDefaultCompanyWebId());
|
||||
|
@ -58,14 +75,30 @@ public class LiferayUserManager implements UserManager {
|
|||
}
|
||||
return defaultWebId;
|
||||
}
|
||||
|
||||
private static UserModel mapLRUser(User u) throws PortalException, SystemException {
|
||||
/**
|
||||
* this method sets the Admin privileges in the local thread, needed to perform such operations.
|
||||
*/
|
||||
private void doAsAdmin() {
|
||||
try {
|
||||
String adminUsername = PortalContext.getConfiguration().getAdministratorUsername();
|
||||
long userId = getUserByUsername(adminUsername).getUserId();
|
||||
PrincipalThreadLocal.setName(userId);
|
||||
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(userId));
|
||||
PermissionThreadLocal.setPermissionChecker(permissionChecker);
|
||||
} catch (IOException e) {
|
||||
System.out.println("/settings.properties file not found in resources");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//simple user mapping
|
||||
private static GCubeUser mapLRUser(User u) throws PortalException, SystemException {
|
||||
if (u != null) {
|
||||
List<Email> emails = new ArrayList<Email>();
|
||||
for (EmailAddress e : u.getEmailAddresses()) {
|
||||
emails.add(new Email(e.getAddress(), e.getType().toString(), e.isPrimary()));
|
||||
}
|
||||
return new UserModel(
|
||||
return new GCubeUser(
|
||||
u.getUserId(),
|
||||
u.getScreenName(),
|
||||
u.getEmailAddress(),
|
||||
|
@ -82,13 +115,52 @@ public class LiferayUserManager implements UserManager {
|
|||
else
|
||||
return null;
|
||||
}
|
||||
//simple role mapping
|
||||
private static GCubeRole mapLRRole(Role r) throws PortalException, SystemException {
|
||||
if (r != null) {
|
||||
return new GCubeRole(r.getName(), r.getRoleId(), r.getDescription());
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
private static GCubeMembershipRequest mapLRMembershipRequest(MembershipRequest req) throws PortalException, SystemException {
|
||||
MembershipRequestStatus requestStatus = MembershipRequestStatus.REQUEST;
|
||||
if (req.getStatusId() == 1)
|
||||
requestStatus = MembershipRequestStatus.APPROVED;
|
||||
else if (req.getStatusId() == 2)
|
||||
requestStatus = MembershipRequestStatus.DENIED;
|
||||
|
||||
//get the user requesting it
|
||||
GCubeUser requestingUser = null;
|
||||
User theUser = UserLocalServiceUtil.getUser(req.getUserId());
|
||||
if (theUser.isActive())
|
||||
requestingUser = mapLRUser(theUser);
|
||||
GCubeUser replierUser = null;
|
||||
if (req.getReplierUserId() != 0) { //means there is a reply for this request
|
||||
User theReplier = UserLocalServiceUtil.getUser(req.getReplierUserId());
|
||||
if (theUser.isActive())
|
||||
replierUser = mapLRUser(theReplier);
|
||||
}
|
||||
|
||||
GCubeMembershipRequest toReturn = new GCubeMembershipRequest(
|
||||
req.getMembershipRequestId(),
|
||||
req.getGroupId(),
|
||||
requestingUser,
|
||||
req.getCreateDate(),
|
||||
req.getComments(),
|
||||
req.getReplyComments(),
|
||||
replierUser,
|
||||
req.getCreateDate(),
|
||||
requestStatus);
|
||||
return toReturn;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public UserModel getUserByUsername(String username) throws UserManagementSystemException, UserRetrievalFault {
|
||||
public GCubeUser getUserByUsername(String username) throws UserManagementSystemException, UserRetrievalFault {
|
||||
User toGet = null;
|
||||
UserModel toReturn = null;
|
||||
GCubeUser toReturn = null;
|
||||
try {
|
||||
toGet = UserLocalServiceUtil.getUserByScreenName(getCompany().getCompanyId(), username);
|
||||
toReturn = mapLRUser(toGet);
|
||||
|
@ -103,9 +175,9 @@ public class LiferayUserManager implements UserManager {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public UserModel getUserByEmail(String emailAddress) throws UserManagementSystemException, UserRetrievalFault {
|
||||
public GCubeUser getUserByEmail(String emailAddress) throws UserManagementSystemException, UserRetrievalFault {
|
||||
User toGet = null;
|
||||
UserModel toReturn = null;
|
||||
GCubeUser toReturn = null;
|
||||
try {
|
||||
toGet = UserLocalServiceUtil.getUserByEmailAddress(getCompany().getCompanyId(), emailAddress);
|
||||
toReturn = mapLRUser(toGet);
|
||||
|
@ -118,10 +190,21 @@ public class LiferayUserManager implements UserManager {
|
|||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @throws UserRetrievalFault
|
||||
*/
|
||||
@Override
|
||||
public List<UserModel> listUsers() throws UserManagementSystemException {
|
||||
List<UserModel> toReturn = new ArrayList<UserModel>();
|
||||
public long getUserId(String screenName) throws UserManagementSystemException, UserRetrievalFault {
|
||||
return getUserByUsername(screenName).getUserId();
|
||||
}
|
||||
/*
|
||||
* LISTING ENTITIES
|
||||
*/
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<GCubeUser> listUsers() throws UserManagementSystemException {
|
||||
List<GCubeUser> toReturn = new ArrayList<GCubeUser>();
|
||||
try {
|
||||
List<User> lrUsers = UserLocalServiceUtil.getUsers(0, UserLocalServiceUtil.getUsersCount());
|
||||
for (User user : lrUsers) {
|
||||
|
@ -139,8 +222,8 @@ public class LiferayUserManager implements UserManager {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<UserModel> listUsersByGroup(long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault {
|
||||
List<UserModel> toReturn = new ArrayList<UserModel>();
|
||||
public List<GCubeUser> listUsersByGroup(long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault {
|
||||
List<GCubeUser> toReturn = new ArrayList<GCubeUser>();
|
||||
try {
|
||||
for (User user : UserLocalServiceUtil.getGroupUsers(groupId)) {
|
||||
if (user.isActive())
|
||||
|
@ -157,8 +240,8 @@ public class LiferayUserManager implements UserManager {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<UserModel> listUsersByGroupName(String name) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault {
|
||||
List<UserModel> toReturn = new ArrayList<UserModel>();
|
||||
public List<GCubeUser> listUsersByGroupName(String name) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault {
|
||||
List<GCubeUser> toReturn = new ArrayList<GCubeUser>();
|
||||
try {
|
||||
Group g = (GroupLocalServiceUtil.getGroup(getCompany().getCompanyId(), name));
|
||||
for (User user : UserLocalServiceUtil.getGroupUsers(g.getGroupId())) {
|
||||
|
@ -172,93 +255,203 @@ public class LiferayUserManager implements UserManager {
|
|||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<UserModel> listPendingUsersByGroup(String groupId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault,
|
||||
UserRetrievalFault {
|
||||
public Map<GCubeUser, List<GCubeRole>> listUsersAndRolesByGroup(long groupId) throws GroupRetrievalFault, UserManagementSystemException, UserRetrievalFault {
|
||||
Map<GCubeUser, List<GCubeRole>> toReturn = new HashMap<GCubeUser, List<GCubeRole>>();
|
||||
try {
|
||||
Group g = GroupLocalServiceUtil.getGroup(groupId);
|
||||
System.out.println("Asked for users and roles of group: "+g.getName());
|
||||
|
||||
for (User user : UserLocalServiceUtil.getGroupUsers(groupId)) {
|
||||
if (user.isActive()) {
|
||||
long userId = user.getUserId();
|
||||
doAsAdmin();
|
||||
List<Role> userRoles = RoleServiceUtil.getUserGroupRoles(userId, groupId);
|
||||
List<GCubeRole> toAdd = new ArrayList<GCubeRole>();
|
||||
for (Role role : userRoles) {
|
||||
toAdd.add(mapLRRole(role));
|
||||
}
|
||||
toReturn.put(mapLRUser(user), toAdd);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (PortalException e1) {
|
||||
throw new GroupRetrievalFault("Group not existing (I think you better check)", e1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<GCubeUser> listUsersByGroupAndRole(long groupId, long roleId) throws UserManagementSystemException, RoleRetrievalFault, GroupRetrievalFault, UserRetrievalFault {
|
||||
Map<GCubeUser, List<GCubeRole>> toIterate = listUsersAndRolesByGroup(groupId);
|
||||
List<GCubeUser> toReturn = new ArrayList<GCubeUser>();
|
||||
Role askedRole = null;
|
||||
try {
|
||||
askedRole = RoleServiceUtil.getRole(roleId);
|
||||
} catch (PortalException e) {
|
||||
throw new RoleRetrievalFault("Role not existing (I think you better check) roleId="+roleId, e);
|
||||
} catch (SystemException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Asked for role: "+askedRole.getName());
|
||||
for (GCubeUser u : toIterate.keySet()) {
|
||||
for (GCubeRole role : toIterate.get(u))
|
||||
if (role.getRoleId() == roleId) {
|
||||
toReturn.add(u);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
/*
|
||||
* END LISTING ENTITIES
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* MEMBERSHIP REQUESTS
|
||||
*/
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<GCubeMembershipRequest> listMembershipRequestsByGroup(long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault {
|
||||
try {
|
||||
Group g = GroupLocalServiceUtil.getGroup(groupId);
|
||||
System.out.println("Asked for pending users list of group: "+g.getName());
|
||||
} catch (PortalException e1) {
|
||||
throw new GroupRetrievalFault("Group not existing", e1);
|
||||
} catch (SystemException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List<GCubeMembershipRequest> toReturn = new ArrayList<GCubeMembershipRequest>();
|
||||
try {
|
||||
int requestesNo = MembershipRequestLocalServiceUtil.getMembershipRequestsCount();
|
||||
for (MembershipRequest req : MembershipRequestLocalServiceUtil.getMembershipRequests(0, requestesNo)) {
|
||||
if (req.getGroupId() == groupId) {
|
||||
toReturn.add(mapLRMembershipRequest(req));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SystemException e) {
|
||||
e.printStackTrace();
|
||||
} catch (PortalException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public GCubeMembershipRequest requestMembership(long userId, long groupId, String comment) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault {
|
||||
try {
|
||||
MembershipRequest req = MembershipRequestLocalServiceUtil.addMembershipRequest(userId, groupId, comment, new ServiceContext());
|
||||
return mapLRMembershipRequest(req);
|
||||
} catch (PortalException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SystemException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public GCubeMembershipRequest acceptMembershipRequest(long requestUserId,long groupId, boolean addUserToGroup, String replyUsername, String replyComment) throws UserManagementSystemException, GroupRetrievalFault, UserManagementPortalException {
|
||||
try {
|
||||
GCubeUser replyMan = getUserByUsername(replyUsername);
|
||||
List<GCubeMembershipRequest> requests = listMembershipRequestsByGroup(groupId);
|
||||
for (GCubeMembershipRequest req : requests) {
|
||||
if (req.getRequestingUser().getUserId() == requestUserId) {
|
||||
MembershipRequestLocalServiceUtil.updateStatus(replyMan.getUserId(), req.getMembershipRequestId(), replyComment, 1, addUserToGroup, new ServiceContext());
|
||||
return mapLRMembershipRequest(MembershipRequestLocalServiceUtil.getMembershipRequest(req.getMembershipRequestId()));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (UserRetrievalFault e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public GCubeMembershipRequest rejectMembershipRequest(long requestUserId, long groupId, String replyUsername, String replyComment) throws UserManagementSystemException, GroupRetrievalFault, UserManagementPortalException {
|
||||
try {
|
||||
GCubeUser replyMan = getUserByUsername(replyUsername);
|
||||
List<GCubeMembershipRequest> requests = listMembershipRequestsByGroup(groupId);
|
||||
for (GCubeMembershipRequest req : requests) {
|
||||
if (req.getRequestingUser().getUserId() == requestUserId) {
|
||||
MembershipRequestLocalServiceUtil.updateStatus(replyMan.getUserId(), req.getMembershipRequestId(), replyComment, 2, false, new ServiceContext());
|
||||
return mapLRMembershipRequest(MembershipRequestLocalServiceUtil.getMembershipRequest(req.getMembershipRequestId()));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (UserRetrievalFault e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/*
|
||||
* END MEMBERSHIP REQUESTS
|
||||
*/
|
||||
|
||||
/*
|
||||
* USER TO Sites ASSIGNMENTS
|
||||
*/
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void assignUserToGroup(long groupId, long userId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault, UserManagementPortalException {
|
||||
try {
|
||||
UserLocalServiceUtil.addGroupUser(groupId, userId);
|
||||
GroupManager gm = new LiferayGroupManager();
|
||||
if (gm.isVRE(groupId)) {
|
||||
//TODO: add the user to the HL Folder
|
||||
}
|
||||
} catch (SystemException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void dismissUserFromGroup(long groupId, long userId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault {
|
||||
try {
|
||||
UserLocalServiceUtil.deleteGroupUser(groupId, userId);
|
||||
GroupManager gm = new LiferayGroupManager();
|
||||
if (gm.isVRE(groupId)) {
|
||||
//TODO: remove the user to the HL Folder
|
||||
}
|
||||
} catch (SystemException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<GCubeUser> listUnregisteredUsersByGroup(String groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMembershipRequestComment(String userId, String groupId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault,
|
||||
UserRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<UserModel, List<RoleModel>> listUsersAndRolesByGroup(
|
||||
String groupId) throws GroupRetrievalFault,
|
||||
UserManagementSystemException, UserRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<UserModel, List<GroupModel>> listUsersAndGroupsByRole(
|
||||
String roleId) throws UserManagementSystemException,
|
||||
RoleRetrievalFault, UserRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserModel> listUsersByGroupAndRole(String groupId, String roleId)
|
||||
throws UserManagementSystemException, RoleRetrievalFault,
|
||||
GroupRetrievalFault, UserRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignUserToGroup(String groupId, String userId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault,
|
||||
UserRetrievalFault, UserManagementPortalException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismissUserFromGroup(String groupId, String userId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault,
|
||||
UserRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestMembership(String userId, String groupId, String comment)
|
||||
throws UserManagementSystemException, GroupRetrievalFault,
|
||||
UserRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserModel> listUnregisteredUsersByGroup(String groupId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault,
|
||||
UserRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getUserId(String screenName)
|
||||
throws UserManagementSystemException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserModel> getMembershipRequests(String groupId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault,
|
||||
UserRetrievalFault {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HashMap<String, String> getUserCustomAttributes(String userId)
|
||||
|
@ -289,13 +482,8 @@ public class LiferayUserManager implements UserManager {
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void denyMembershipRequest(String userId, String groupId)
|
||||
throws UserManagementSystemException, GroupRetrievalFault,
|
||||
UserManagementPortalException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.vomanagement.usermanagement.model;
|
||||
|
||||
|
||||
public class GroupModel {
|
||||
public class GCubeGroup {
|
||||
|
||||
String groupId;
|
||||
String parentGroupId;
|
||||
|
@ -9,11 +9,11 @@ public class GroupModel {
|
|||
String description;
|
||||
long logoId;
|
||||
|
||||
public GroupModel() {
|
||||
public GCubeGroup() {
|
||||
this("","","","",0L);
|
||||
}
|
||||
|
||||
public GroupModel(String groupId,String parentGroupId, String groupName, String description, long logoId){
|
||||
public GCubeGroup(String groupId,String parentGroupId, String groupName, String description, long logoId){
|
||||
this.groupId = groupId;
|
||||
this.parentGroupId = parentGroupId;
|
||||
this.groupName = groupName;
|
|
@ -0,0 +1,224 @@
|
|||
package org.gcube.vomanagement.usermanagement.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class GCubeMembershipRequest implements Serializable {
|
||||
|
||||
|
||||
|
||||
private long membershipRequestId;
|
||||
private long groupId;
|
||||
private GCubeUser requestingUser;
|
||||
private Date createDate;
|
||||
private String userComment;
|
||||
private String managerReplyComment;
|
||||
private GCubeUser replierUser;
|
||||
private Date replyDate;
|
||||
private MembershipRequestStatus status;
|
||||
|
||||
public GCubeMembershipRequest() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public GCubeMembershipRequest(long membershipRequestId, long groupId,
|
||||
GCubeUser requestingUser, Date createDate, String userComment,
|
||||
String managerReplyComment, GCubeUser replierUser, Date replyDate,
|
||||
MembershipRequestStatus status) {
|
||||
super();
|
||||
this.membershipRequestId = membershipRequestId;
|
||||
this.groupId = groupId;
|
||||
this.requestingUser = requestingUser;
|
||||
this.createDate = createDate;
|
||||
this.userComment = userComment;
|
||||
this.managerReplyComment = managerReplyComment;
|
||||
this.replierUser = replierUser;
|
||||
this.replyDate = replyDate;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the membership request ID of this membership request.
|
||||
*
|
||||
* @return the membership request ID of this membership request
|
||||
*/
|
||||
public long getMembershipRequestId() {
|
||||
return membershipRequestId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the membership request ID of this membership request.
|
||||
*
|
||||
* @param membershipRequestId the membership request ID of this membership request
|
||||
*/
|
||||
public void setMembershipRequestId(long membershipRequestId) {
|
||||
this.membershipRequestId = membershipRequestId;
|
||||
}
|
||||
/**
|
||||
* Returns the group ID of this membership request.
|
||||
*
|
||||
* @return the group ID of this membership request
|
||||
*/
|
||||
public long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the group ID of this membership request.
|
||||
*
|
||||
* @param groupId the group ID of this membership request
|
||||
*/
|
||||
public void setGroupId(long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the create date of this membership request.
|
||||
*
|
||||
* @return the create date of this membership request
|
||||
*/
|
||||
public Date getCreateDate() {
|
||||
return this.createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the create date of this membership request.
|
||||
*
|
||||
* @param createDate the create date of this membership request
|
||||
*/
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the comment of this membership request.
|
||||
*
|
||||
* @return the comment of this membership request
|
||||
*/
|
||||
public String getComment() {
|
||||
return userComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the comments of this membership request.
|
||||
*
|
||||
* @param userComment the comments of this membership request
|
||||
*/
|
||||
public void setComment(String userComment) {
|
||||
this.userComment = userComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reply comments of this membership request.
|
||||
*
|
||||
* @return the reply comments of this membership request
|
||||
*/
|
||||
public String getManagerReplyComment() {
|
||||
return managerReplyComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the reply comments of this membership request.
|
||||
*
|
||||
* @param replyComment the reply comments of this membership request
|
||||
*/
|
||||
public void setReplyComment(String replyComment) {
|
||||
this.managerReplyComment = replyComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reply date of this membership request.
|
||||
*
|
||||
* @return the reply date of this membership request
|
||||
*/
|
||||
public Date getReplyDate() {
|
||||
return replyDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the reply date of this membership request.
|
||||
*
|
||||
* @param replyDate the reply date of this membership request
|
||||
*/
|
||||
public void setReplyDate(Date replyDate) {
|
||||
this.replyDate = replyDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status of this membership request.
|
||||
*
|
||||
* @return the status of this membership request
|
||||
*/
|
||||
//note for developer
|
||||
public MembershipRequestStatus getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the status of this membership request.
|
||||
*
|
||||
* @param statusId the status of this membership request
|
||||
*/
|
||||
public void setStatusId(MembershipRequestStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getUserComment() {
|
||||
return userComment;
|
||||
}
|
||||
|
||||
public void setUserComment(String userComment) {
|
||||
this.userComment = userComment;
|
||||
}
|
||||
|
||||
public void setManagerReplyComment(String managerReplyComment) {
|
||||
this.managerReplyComment = managerReplyComment;
|
||||
}
|
||||
|
||||
public void setStatus(MembershipRequestStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public GCubeUser getRequestingUser() {
|
||||
return requestingUser;
|
||||
}
|
||||
|
||||
|
||||
public void setRequestingUser(GCubeUser requestingUser) {
|
||||
this.requestingUser = requestingUser;
|
||||
}
|
||||
|
||||
|
||||
public GCubeUser getReplierUser() {
|
||||
return replierUser;
|
||||
}
|
||||
|
||||
|
||||
public void setReplierUser(GCubeUser replierUser) {
|
||||
this.replierUser = replierUser;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GCubeMembershipRequest [membershipRequestId="
|
||||
+ membershipRequestId + ", groupId=" + groupId
|
||||
+ ", requestingUser=" + requestingUser + ", createDate="
|
||||
+ createDate + ", userComment=" + userComment
|
||||
+ ", managerReplyComment=" + managerReplyComment
|
||||
+ ", replierUser=" + replierUser + ", replyDate=" + replyDate
|
||||
+ ", status=" + status + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,17 +1,18 @@
|
|||
package org.gcube.vomanagement.usermanagement.model;
|
||||
|
||||
public class RoleModel {
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class GCubeRole implements Serializable {
|
||||
|
||||
String roleName;
|
||||
String roleId;
|
||||
long roleId;
|
||||
String description;
|
||||
String completeName;
|
||||
|
||||
|
||||
public RoleModel(){
|
||||
public GCubeRole(){
|
||||
|
||||
}
|
||||
public RoleModel(String roleName,String roleId, String description){
|
||||
public GCubeRole(String roleName,long roleId, String description){
|
||||
this.roleName = roleName;
|
||||
this.roleId = roleId;
|
||||
this.description = description;
|
||||
|
@ -23,27 +24,23 @@ public class RoleModel {
|
|||
public void setRoleName(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
public String getRoleId() {
|
||||
public long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
public void setRoleId(String roleId) {
|
||||
public void setRoleId(long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public String getCompleteName() {
|
||||
return completeName;
|
||||
}
|
||||
public void setCompleteName(String completeName) {
|
||||
this.completeName = completeName;
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GCubeRole [roleName=" + roleName + ", roleId=" + roleId
|
||||
+ ", description=" + description + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -12,7 +12,7 @@ import java.util.Map;
|
|||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class UserModel implements Serializable {
|
||||
public class GCubeUser implements Serializable {
|
||||
private long userId;
|
||||
private String username;
|
||||
private String email;
|
||||
|
@ -42,7 +42,7 @@ public class UserModel implements Serializable {
|
|||
* @param customAttrsMap
|
||||
* @param emailAddresses
|
||||
*/
|
||||
public UserModel(long userId, String username, String email,
|
||||
public GCubeUser(long userId, String username, String email,
|
||||
String firstName, String middleName, String lastName,
|
||||
String fullname, long registrationDate, String userAvatarId,
|
||||
boolean male, String jobTitle, Map<String, String> customAttrsMap,
|
||||
|
@ -77,7 +77,7 @@ public class UserModel implements Serializable {
|
|||
* @param jobTitle
|
||||
* @param emailAddresses
|
||||
*/
|
||||
public UserModel(long userId, String username, String email,
|
||||
public GCubeUser(long userId, String username, String email,
|
||||
String firstName, String middleName, String lastName,
|
||||
String fullname, long registrationDate, String userAvatarId,
|
||||
boolean male, String jobTitle,
|
||||
|
@ -201,7 +201,7 @@ public class UserModel implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserModel [userId=" + userId + ", username=" + username
|
||||
return "GCubeUser [userId=" + userId + ", username=" + username
|
||||
+ ", email=" + email + ", firstName=" + firstName
|
||||
+ ", middleName=" + middleName + ", lastName=" + lastName
|
||||
+ ", fullname=" + fullname + ", registrationDate="
|
|
@ -0,0 +1,5 @@
|
|||
package org.gcube.vomanagement.usermanagement.model;
|
||||
|
||||
public enum MembershipRequestStatus {
|
||||
REQUEST, APPROVED, DENIED;
|
||||
}
|
|
@ -1 +1 @@
|
|||
sharedDir=${catalina.home}/shared/d4s
|
||||
administratorUsername=massimiliano.assante
|
||||
|
|
Loading…
Reference in New Issue