now revoked or assigned roles arrive to the server, still to be managed

This commit is contained in:
Massimiliano Assante 2021-05-12 19:11:24 +02:00
parent 51620bc664
commit 5cb7bbb3a1
3 changed files with 877 additions and 836 deletions

View File

@ -74,6 +74,7 @@ public class UsersManagementPortletHome extends GenericPortlet {
private static final int DELETE_SITE_TEAMS_TABLE = 0;
private static final int MASS_EDIT_USERS = 0;
private static final int ASSIGN_ROLES_TO_USERS = 1;
private static final int REMOVE_ROLES_TO_USERS = 3;
private static final int ASSIGN_TEAMS_TO_USERS = 2;
public void init() {
@ -557,9 +558,17 @@ public class UsersManagementPortletHome extends GenericPortlet {
HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(request);
_log.debug("Editing users for the group: " + groupName);
if(usersIDs.length == 1){//You can delete previous roles of a single user only.
_log.debug("*** \n\n Editing users for the context: " + groupName);
System.out.println("\n\n****");
System.out.println("long[] usersIDs="+usersIDs.toString());
System.out.println("String[] theRoles="+theRoles.toString());
System.out.println("deletePreviousRoles?="+deletePreviousRoles);
System.out.println("selfId="+selfId);
System.out.println("int typeOfChangesUpponUserMode is="+typeOfChangesUpponUserMode);
System.out.println("usersIDs.length="+usersIDs.length);
if(usersIDs.length == 1) {//You can delete previous roles of a single user only.
GCubeUser gcu = lum.getUserById(usersIDs[0]);
long[] roleIDs = new long[theRoles.length];
GCubeRole[] gCubeRoles = new GCubeRole[theRoles.length];
@ -572,20 +581,12 @@ public class UsersManagementPortletHome extends GenericPortlet {
newRoleIDs[i] = gCubeRoles[i].getRoleId();
}
if(deletePreviousRoles && typeOfChangesUpponUserMode == MASS_EDIT_USERS){
_log.debug("MASS_EDIT_USERS");
try{
lrm.removeAllRolesFromUser(gcu.getUserId(), groupId);
}catch(Exception e){
e.printStackTrace();
}
if(typeOfChangesUpponUserMode == REMOVE_ROLES_TO_USERS){
System.out.println("\n\n\n ****** REMOVE_ROLES_TO_USERS");
// List<GCubeTeam> teams = lrm.listTeamsByGroup(groupId);
// if(teams.size() > 0 ){
// lrm.deleteUserTeams(gcu.getUserId(), teams);
// }
} else if(deletePreviousRoles && typeOfChangesUpponUserMode == ASSIGN_ROLES_TO_USERS){
_log.debug("ASSIGN_ROLES_TO_USERS");
}
else if(typeOfChangesUpponUserMode == ASSIGN_ROLES_TO_USERS){
_log.info("\n\n\n ****** ASSIGN_ROLES_TO_USERS");
try{
lrm.removeAllRolesFromUser(gcu.getUserId(), groupId);
}catch(Exception e){
@ -599,7 +600,7 @@ public class UsersManagementPortletHome extends GenericPortlet {
String[] gCubeTeamNames = new String[usersTeams.length];
StringBuffer teamNames = new StringBuffer();
for(int i=0; i<usersTeams.length; i++){
for (int i=0; i<usersTeams.length; i++) {
GCubeTeam team = null;
try {
team = lrm.getTeam(groupId, usersTeams[i].trim());
@ -706,7 +707,10 @@ public class UsersManagementPortletHome extends GenericPortlet {
}
_log.debug("User: " + currentUser.getUsername() + " is editing the roles of user: "+ gcu.getUsername() + " for the site: " + groupName + "and deletes all previous site-roles");
}else{
} //END EDIT ROLES
else {
List<GCubeTeam> existingGCubeTeams = lrm.listTeamsByGroup(groupId);

File diff suppressed because it is too large Load Diff

View File

@ -78,6 +78,7 @@
var MASS_EDIT_USERS = 0;
var ASSIGN_ROLES_TO_USERS = 1;
var ASSIGN_TEAMS_TO_USERS = 2;
var REMOVE_ROLES_TO_USERS = 3;
var handlersAppliedToToolbarForFirstTime = false;
</script>
@ -500,11 +501,9 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
</div>
<div class="modal-body">
<div class="modal-body">
</div>
<div class="modal-footer">
<button id="openEditModal" class="btn btn-link btn-large">Edit</button>
<button id="closeUSerDetailsModal" class="btn btn-link btn-large" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>