git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerCore@42163 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8237defd93
commit
70d83b5d5d
|
@ -1,5 +1,13 @@
|
||||||
package org.gcube.application.framework.core.security;
|
package org.gcube.application.framework.core.security;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -11,6 +19,8 @@ import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||||
import org.apache.axis.types.URI.MalformedURIException;
|
import org.apache.axis.types.URI.MalformedURIException;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.application.framework.core.util.ASLGroupModel;
|
import org.gcube.application.framework.core.util.ASLGroupModel;
|
||||||
|
import org.gcube.application.framework.core.util.Settings;
|
||||||
|
import org.gcube.application.framework.core.util.UsersManagementServiceConstants;
|
||||||
import org.gcube.vomanagement.usermanagement.ws.GetGroupParentId;
|
import org.gcube.vomanagement.usermanagement.ws.GetGroupParentId;
|
||||||
import org.gcube.vomanagement.usermanagement.ws.GetRootVO;
|
import org.gcube.vomanagement.usermanagement.ws.GetRootVO;
|
||||||
import org.gcube.vomanagement.usermanagement.ws.GetScope;
|
import org.gcube.vomanagement.usermanagement.ws.GetScope;
|
||||||
|
@ -30,11 +40,44 @@ import org.gcube.vomanagement.usermanagement.ws.service.LiferaySOAPUserManagerSe
|
||||||
|
|
||||||
public class UsersManagementUtils {
|
public class UsersManagementUtils {
|
||||||
|
|
||||||
public static ArrayList<String> getAllScopes(ASLSession session) {
|
String umServiceLocation = new String();
|
||||||
|
|
||||||
|
public UsersManagementUtils() {
|
||||||
|
StringBuffer fileData = new StringBuffer(1000);
|
||||||
|
BufferedReader reader = null;
|
||||||
|
try {
|
||||||
|
reader = new BufferedReader(new FileReader(Settings.getInstance().getProperty("sharedDir")+ File.separator + "UMServiceLocation.config"));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
int numRead = 0;
|
||||||
|
char[] buf = new char[1024];
|
||||||
|
try {
|
||||||
|
while((numRead=reader.read(buf)) != -1){
|
||||||
|
String readData = String.valueOf(buf, 0, numRead);
|
||||||
|
fileData.append(readData);
|
||||||
|
buf = new char[1024];
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
reader.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
umServiceLocation = fileData.toString().trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getAllScopes(ASLSession session) {
|
||||||
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
||||||
ArrayList<String> groupsNames = new ArrayList<String>();
|
ArrayList<String> groupsNames = new ArrayList<String>();
|
||||||
try {
|
try {
|
||||||
endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
||||||
|
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
|
||||||
} catch (MalformedURIException e) {
|
} catch (MalformedURIException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -80,12 +123,13 @@ public class UsersManagementUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getRootVO() {
|
public String getRootVO() {
|
||||||
|
|
||||||
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
||||||
ArrayList<String> groupsNames = new ArrayList<String>();
|
ArrayList<String> groupsNames = new ArrayList<String>();
|
||||||
try {
|
try {
|
||||||
endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
||||||
|
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
|
||||||
} catch (MalformedURIException e) {
|
} catch (MalformedURIException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -130,11 +174,12 @@ public class UsersManagementUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getUserId(String username) {
|
public String getUserId(String username) {
|
||||||
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
||||||
String userId = null;
|
String userId = null;
|
||||||
try {
|
try {
|
||||||
endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPUserManager"));
|
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPUserManager"));
|
||||||
|
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPUserManager));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LiferaySOAPUserManagerPortType userManagerStub = new LiferaySOAPUserManagerServiceAddressingLocator().getLiferaySOAPUserManagerPortTypePort(endpointUser);
|
LiferaySOAPUserManagerPortType userManagerStub = new LiferaySOAPUserManagerServiceAddressingLocator().getLiferaySOAPUserManagerPortTypePort(endpointUser);
|
||||||
|
@ -160,11 +205,12 @@ public class UsersManagementUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<ASLGroupModel> listGroupsByUser(String userId) {
|
public List<ASLGroupModel> listGroupsByUser(String userId) {
|
||||||
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
||||||
List<ASLGroupModel> groupsByUser = new ArrayList<ASLGroupModel>();
|
List<ASLGroupModel> groupsByUser = new ArrayList<ASLGroupModel>();
|
||||||
try {
|
try {
|
||||||
endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
||||||
|
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
|
||||||
} catch (MalformedURIException e) {
|
} catch (MalformedURIException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -198,11 +244,12 @@ public class UsersManagementUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<ASLGroupModel> listGroups() {
|
public List<ASLGroupModel> listGroups() {
|
||||||
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
||||||
List<ASLGroupModel> groups = new ArrayList<ASLGroupModel>();
|
List<ASLGroupModel> groups = new ArrayList<ASLGroupModel>();
|
||||||
try {
|
try {
|
||||||
endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
||||||
|
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
|
||||||
} catch (MalformedURIException e) {
|
} catch (MalformedURIException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -235,12 +282,13 @@ public class UsersManagementUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean isVO(String groupId) {
|
public boolean isVO(String groupId) {
|
||||||
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
||||||
List<GroupModel> groups = new ArrayList<GroupModel>();
|
List<GroupModel> groups = new ArrayList<GroupModel>();
|
||||||
boolean isVO = false;
|
boolean isVO = false;
|
||||||
try {
|
try {
|
||||||
endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
||||||
|
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
|
||||||
} catch (MalformedURIException e) {
|
} catch (MalformedURIException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -272,11 +320,12 @@ public class UsersManagementUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean isRootVO(String groupId) {
|
public boolean isRootVO(String groupId) {
|
||||||
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
||||||
boolean isVO = false;
|
boolean isVO = false;
|
||||||
try {
|
try {
|
||||||
endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
||||||
|
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
|
||||||
} catch (MalformedURIException e) {
|
} catch (MalformedURIException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -308,10 +357,11 @@ public class UsersManagementUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getScope(String groupId) {
|
public String getScope(String groupId) {
|
||||||
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
||||||
try {
|
try {
|
||||||
endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
||||||
|
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
|
||||||
} catch (MalformedURIException e) {
|
} catch (MalformedURIException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -342,10 +392,11 @@ public class UsersManagementUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getGroupParentId(String groupId) {
|
public String getGroupParentId(String groupId) {
|
||||||
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
EndpointReferenceType endpointUser = new EndpointReferenceType();
|
||||||
try {
|
try {
|
||||||
endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
|
||||||
|
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
|
||||||
} catch (MalformedURIException e) {
|
} catch (MalformedURIException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue