Feature #21269: make roles assigned or removed in different operations
This commit is contained in:
parent
bc5f309fc5
commit
5e8dd211b5
|
@ -5,10 +5,10 @@ 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).
|
||||||
|
|
||||||
|
|
||||||
## [v4.0.0-SNAPSHOT] - 2021-05-04
|
## [v4.0.0-SNAPSHOT] - 2021-05-13
|
||||||
|
|
||||||
Porting to git, see other changelog.xml for more changelogs.
|
|
||||||
|
|
||||||
|
- Feature #21269: make roles either assigned or removed in different operations, not mixed.
|
||||||
|
- Ported to git, see other changelog.xml for more changelogs.
|
||||||
|
|
||||||
## [v1.0.0] - 2016-06-20
|
## [v1.0.0] - 2016-06-20
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,11 @@ See [Releases](https://code-repo.d4science.org/gCubeSystem/UsersManagementPortle
|
||||||
|
|
||||||
* **Panagiota Koltsida** - [National and Kapodistrian University of Athens & Athena' Research Center)
|
* **Panagiota Koltsida** - [National and Kapodistrian University of Athens & Athena' Research Center)
|
||||||
* **Vassilis Floros** - [Communication & Information Technologies Experts S.A - CITE (Greece)]
|
* **Vassilis Floros** - [Communication & Information Technologies Experts S.A - CITE (Greece)]
|
||||||
|
* **Massimiliano Assante** - [ISTI-CNR Infrascience Group](http://nemis.isti.cnr.it/groups/infrascience)
|
||||||
|
|
||||||
## Maintainers
|
## Maintainers
|
||||||
|
|
||||||
* **Massimiliano Assante** - [ISTI-CNR InfraScience Laboratory]
|
* **Massimiliano Assante** - [ISTI-CNR Infrascience Group](http://nemis.isti.cnr.it/groups/infrascience)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
@ -551,8 +551,9 @@ public class UsersManagementPortletHome extends GenericPortlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* this method assign or revoke VE Groups to one user
|
||||||
* manage the assignment to teams
|
* manage the assignment to teams
|
||||||
* @param groupId
|
* @param groupId the LR Site groupID
|
||||||
* @param usersIDs
|
* @param usersIDs
|
||||||
* @param usersTeams
|
* @param usersTeams
|
||||||
* @param selfId
|
* @param selfId
|
||||||
|
@ -641,22 +642,17 @@ public class UsersManagementPortletHome extends GenericPortlet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Called in case of User Assignment or Revokations of roles or assign/remove group, see typeOfChangesUpponUserMode param
|
||||||
*
|
*
|
||||||
* @param groupId
|
* @param groupId the LR Site groupID
|
||||||
* @param usersIDs
|
* @param usersIDs the LR userIDs that are subject for this operation
|
||||||
* @param theRoles
|
* @param theRoles
|
||||||
* @param usersTeams
|
* @param usersTeams
|
||||||
* @param deletePreviousRoles
|
* @param deletePreviousRoles should not be used anymore
|
||||||
* @param selfId
|
* @param selfId
|
||||||
* @param typeOfChangesUpponUserMode
|
* @param typeOfChangesUpponUserMode is the Number of operation (1:assign role, 2: assign/remove group, 3:revoke role)
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
* @throws SystemException
|
|
||||||
* @throws PortalException
|
|
||||||
* @throws UserManagementSystemException
|
|
||||||
* @throws UserRetrievalFault
|
|
||||||
* @throws RoleRetrievalFault
|
|
||||||
* @throws GroupRetrievalFault
|
|
||||||
*/
|
*/
|
||||||
protected JSONArray usersForCurrrentUsersTablePlusRoles( Long groupId,
|
protected JSONArray usersForCurrrentUsersTablePlusRoles( Long groupId,
|
||||||
long[] usersIDs, String[] theRoles, String[] usersTeams,
|
long[] usersIDs, String[] theRoles, String[] usersTeams,
|
||||||
|
@ -671,10 +667,7 @@ public class UsersManagementPortletHome extends GenericPortlet {
|
||||||
String groupName = lgm.getGroup(groupId).getGroupName();
|
String groupName = lgm.getGroup(groupId).getGroupName();
|
||||||
|
|
||||||
HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(request);
|
HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(request);
|
||||||
|
_log.info("Editing users roles or group for the context: " + groupName);
|
||||||
_log.debug("Editing users for the context: " + groupName);
|
|
||||||
|
|
||||||
|
|
||||||
_log.debug("String[] theRoles length?="+theRoles.length);
|
_log.debug("String[] theRoles length?="+theRoles.length);
|
||||||
for (int i = 0; i < theRoles.length; i++) {
|
for (int i = 0; i < theRoles.length; i++) {
|
||||||
_log.debug("role: "+theRoles[i]);
|
_log.debug("role: "+theRoles[i]);
|
||||||
|
@ -683,11 +676,12 @@ public class UsersManagementPortletHome extends GenericPortlet {
|
||||||
for (int i = 0; i < usersTeams.length; i++) {
|
for (int i = 0; i < usersTeams.length; i++) {
|
||||||
_log.debug("team: "+usersTeams[i]);
|
_log.debug("team: "+usersTeams[i]);
|
||||||
}
|
}
|
||||||
_log.debug("Number of operation ((1:assign role, 2: assign/remove group, 3:revoke role) is ="+typeOfChangesUpponUserMode);
|
_log.info("Number of operation (1:assign role, 2: assign/remove group, 3:revoke role) is ="+typeOfChangesUpponUserMode);
|
||||||
_log.debug("usersIDs.length="+usersIDs.length);
|
_log.debug("usersIDs.length="+usersIDs.length);
|
||||||
|
|
||||||
if(usersIDs.length == 1) {// SINGLE USER EDIT, support assignment and removal of roles and groups
|
if(usersIDs.length == 1) {// SINGLE USER EDIT, support assignment and removal of roles and groups
|
||||||
GCubeUser gcu = lum.getUserById(usersIDs[0]);
|
GCubeUser gcu = lum.getUserById(usersIDs[0]);
|
||||||
|
_log.debug("single edit for user: "+gcu.getUsername());
|
||||||
long[] roleIDs = new long[theRoles.length];
|
long[] roleIDs = new long[theRoles.length];
|
||||||
GCubeRole[] gCubeRoles = new GCubeRole[theRoles.length];
|
GCubeRole[] gCubeRoles = new GCubeRole[theRoles.length];
|
||||||
long[] newRoleIDs = new long[theRoles.length];
|
long[] newRoleIDs = new long[theRoles.length];
|
||||||
|
@ -753,13 +747,14 @@ public class UsersManagementPortletHome extends GenericPortlet {
|
||||||
} //END EDIT ROLES for single user
|
} //END EDIT ROLES for single user
|
||||||
|
|
||||||
else { //MULTIUSER ASSIGNMENT of Roles only and Groups/Sites add and removal
|
else { //MULTIUSER ASSIGNMENT of Roles only and Groups/Sites add and removal
|
||||||
System.out.println("MULTIUSER ASSIGNMENT type?="+typeOfChangesUpponUserMode);
|
_log.info("MULTIUSER ASSIGNMENT type?="+typeOfChangesUpponUserMode);
|
||||||
List<GCubeTeam> existingGCubeTeams = lrm.listTeamsByGroup(groupId);
|
List<GCubeTeam> existingGCubeTeams = lrm.listTeamsByGroup(groupId);
|
||||||
|
|
||||||
for (long uid : usersIDs) { //for each user
|
for (long uid : usersIDs) { //for each user
|
||||||
|
|
||||||
GCubeUser user = lum.getUserById(uid);
|
GCubeUser user = lum.getUserById(uid);
|
||||||
GCubeUser gcu = lum.getUserByUsername(user.getUsername());
|
GCubeUser gcu = lum.getUserByUsername(user.getUsername());
|
||||||
|
_log.debug("iterating user: "+user.getUsername());
|
||||||
|
|
||||||
List<GCubeUser> usersInTeam = new ArrayList<GCubeUser>();
|
List<GCubeUser> usersInTeam = new ArrayList<GCubeUser>();
|
||||||
|
|
||||||
|
@ -816,7 +811,7 @@ public class UsersManagementPortletHome extends GenericPortlet {
|
||||||
String[] gCubeTeamNames = new String[usersTeams.length];
|
String[] gCubeTeamNames = new String[usersTeams.length];
|
||||||
StringBuffer teamNames = new StringBuffer();
|
StringBuffer teamNames = new StringBuffer();
|
||||||
|
|
||||||
for(int i=0; i<usersTeams.length; i++){
|
for (int i=0; i<usersTeams.length; i++) {
|
||||||
GCubeTeam team = null;
|
GCubeTeam team = null;
|
||||||
try {
|
try {
|
||||||
team = lrm.getTeam(groupId, usersTeams[i].trim());
|
team = lrm.getTeam(groupId, usersTeams[i].trim());
|
||||||
|
@ -838,14 +833,11 @@ public class UsersManagementPortletHome extends GenericPortlet {
|
||||||
existingGCubeTeamsIDs.addAll(gCubeTeamIDs);
|
existingGCubeTeamsIDs.addAll(gCubeTeamIDs);
|
||||||
long[] gCubeTeamsIDsToBeAddedToTheUser = new long[existingGCubeTeamsIDs.size()];
|
long[] gCubeTeamsIDsToBeAddedToTheUser = new long[existingGCubeTeamsIDs.size()];
|
||||||
int i=0;
|
int i=0;
|
||||||
for(Long l : existingGCubeTeamsIDs){
|
for (Long l : existingGCubeTeamsIDs) {
|
||||||
gCubeTeamsIDsToBeAddedToTheUser[i] = l;
|
gCubeTeamsIDsToBeAddedToTheUser[i] = l;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
List<GCubeTeam> oldUserTeams = lrm.listTeamsByUserAndGroup(gcu.getUserId(), groupId);
|
List<GCubeTeam> oldUserTeams = lrm.listTeamsByUserAndGroup(gcu.getUserId(), groupId);
|
||||||
List<Long> oldUserTeamsIDs = new ArrayList<Long>();
|
List<Long> oldUserTeamsIDs = new ArrayList<Long>();
|
||||||
for(Iterator<GCubeTeam> it = oldUserTeams.iterator(); it.hasNext();) {
|
for(Iterator<GCubeTeam> it = oldUserTeams.iterator(); it.hasNext();) {
|
||||||
|
@ -897,7 +889,20 @@ public class UsersManagementPortletHome extends GenericPortlet {
|
||||||
|
|
||||||
return currentGroupUsers( groupId, selfId, httpServletRequest);
|
return currentGroupUsers( groupId, selfId, httpServletRequest);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param portletRequest
|
||||||
|
* @param request
|
||||||
|
* @param groupId
|
||||||
|
* @param userIDs
|
||||||
|
* @param membershipRequestsIDs
|
||||||
|
* @param sendDismissalEmail
|
||||||
|
* @throws SystemException
|
||||||
|
* @throws PortalException
|
||||||
|
* @throws UserManagementSystemException
|
||||||
|
* @throws UserRetrievalFault
|
||||||
|
* @throws GroupRetrievalFault
|
||||||
|
*/
|
||||||
protected void removeUsersFromGroup(PortletRequest portletRequest, ResourceRequest request, long groupId, long[] userIDs,
|
protected void removeUsersFromGroup(PortletRequest portletRequest, ResourceRequest request, long groupId, long[] userIDs,
|
||||||
long[] membershipRequestsIDs, boolean sendDismissalEmail)
|
long[] membershipRequestsIDs, boolean sendDismissalEmail)
|
||||||
throws SystemException, PortalException, UserManagementSystemException,
|
throws SystemException, PortalException, UserManagementSystemException,
|
||||||
|
|
Loading…
Reference in New Issue