improved AcceptMembershipRequests method
This commit is contained in:
parent
e93669c2f0
commit
4d01a9a38b
|
@ -4,11 +4,11 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [v2.5.2] - 2020-10-16
|
## [v2.5.2] - 2020-10-19
|
||||||
|
|
||||||
Bug Fix
|
Bug Fix
|
||||||
|
|
||||||
[#19978] LiferayUserManager#listMembershipRequestsByGroup issue in returned list
|
[#19978] LiferayUserManager#listMembershipRequestsByGroup issue in returned list and improved AcceptMembershipRequests method
|
||||||
|
|
||||||
## [v2.5.1] [r4.25.0] - 2020-07-10
|
## [v2.5.1] [r4.25.0] - 2020-07-10
|
||||||
|
|
||||||
|
|
|
@ -973,16 +973,17 @@ public class LiferayUserManager implements UserManager {
|
||||||
public GCubeMembershipRequest acceptMembershipRequest(long requestUserId,long groupId, boolean addUserToGroup, String replyUsername, String replyComment) throws UserManagementSystemException, GroupRetrievalFault, UserManagementPortalException {
|
public GCubeMembershipRequest acceptMembershipRequest(long requestUserId,long groupId, boolean addUserToGroup, String replyUsername, String replyComment) throws UserManagementSystemException, GroupRetrievalFault, UserManagementPortalException {
|
||||||
try {
|
try {
|
||||||
GCubeUser replyMan = getUserByUsername(replyUsername);
|
GCubeUser replyMan = getUserByUsername(replyUsername);
|
||||||
List<GCubeMembershipRequest> requests = listMembershipRequestsByGroup(groupId);
|
List<MembershipRequest> requests = MembershipRequestLocalServiceUtil.getMembershipRequests(requestUserId, groupId, 0);
|
||||||
for (GCubeMembershipRequest req : requests) {
|
//List<GCubeMembershipRequest> requests = listMembershipRequestsByGroup(groupId);
|
||||||
if (req.getRequestingUser().getUserId() == requestUserId) {
|
for (MembershipRequest req : requests) {
|
||||||
|
if (req.getUserId() == requestUserId) {
|
||||||
MembershipRequestLocalServiceUtil.updateStatus(replyMan.getUserId(), req.getMembershipRequestId(), replyComment, 1, addUserToGroup, new ServiceContext());
|
MembershipRequestLocalServiceUtil.updateStatus(replyMan.getUserId(), req.getMembershipRequestId(), replyComment, 1, addUserToGroup, new ServiceContext());
|
||||||
//the method above just adds the user to the VRE, it is needed to add the user to the parent Sites as well (VO and RootVO)
|
//the method above just adds the user to the VRE, it is needed to add the user to the parent Sites as well (VO and RootVO)
|
||||||
assignUserToGroup(GroupLocalServiceUtil.getGroup(groupId).getParentGroupId(), requestUserId);
|
assignUserToGroup(GroupLocalServiceUtil.getGroup(groupId).getParentGroupId(), requestUserId);
|
||||||
|
_log.info("Accepted membership request: requestUserId="+requestUserId);
|
||||||
return mapLRMembershipRequest(MembershipRequestLocalServiceUtil.getMembershipRequest(req.getMembershipRequestId()));
|
return mapLRMembershipRequest(MembershipRequestLocalServiceUtil.getMembershipRequest(req.getMembershipRequestId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (UserRetrievalFault e) {
|
} catch (UserRetrievalFault e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue