Mention users list now returns only the list of the available users in the current organization
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@94735 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d64ce6cfda
commit
fbecbb7c87
|
@ -10,6 +10,7 @@
|
|||
<Change>Several improvements in url checkings</Change>
|
||||
<Change>resolved problem with AdBlock plugin </Change>
|
||||
<Change>Fixed mention user dialog y-position when textbox is higher than usual due to new lines</Change>
|
||||
<Change>Mention users list now returns only the list of the available users in the current organization</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets.user.shareupdates.1-1-3"
|
||||
date="2014-02-10">
|
||||
|
|
|
@ -568,13 +568,37 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
|||
|
||||
@Override
|
||||
public ArrayList<PickingUser> getPortalUsers() {
|
||||
ASLSession session = getASLSession();
|
||||
return getOrganizationUsers(session.getScope(), session.getUsername(), withinPortal);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param session the Asl Session
|
||||
* @param withinPortal true when is on Liferay portal
|
||||
* @return the users belonging to the current organization (scope)
|
||||
*/
|
||||
public static ArrayList<PickingUser> getOrganizationUsers(String scope, String currUser, boolean withinPortal) {
|
||||
ArrayList<PickingUser> portalUsers = new ArrayList<PickingUser>();
|
||||
String currUser = getASLSession().getUsername();
|
||||
try {
|
||||
if (withinPortal) {
|
||||
UserManager um = new LiferayUserManager();
|
||||
GroupManager gm = new LiferayGroupManager();
|
||||
List<UserModel> users = um.listUsersByGroup(gm.getRootVO().getGroupId());
|
||||
ScopeBean sb = new ScopeBean(scope);
|
||||
List<UserModel> users = null;
|
||||
|
||||
if (sb.is(Type.INFRASTRUCTURE))
|
||||
users = um.listUsersByGroup(gm.getRootVO().getGroupId());
|
||||
else if (sb.is(Type.VRE)) { //must be in VRE
|
||||
//get the name from the scope
|
||||
String orgName = scope.substring(scope.lastIndexOf("/")+1, scope.length());
|
||||
//ask the users
|
||||
users = um.listUsersByGroup(gm.getGroupId(orgName));
|
||||
}
|
||||
else {
|
||||
_log.error("Error, you must be in SCOPE VRE OR INFRASTURCTURE, you are in VO SCOPE returning no users");
|
||||
return portalUsers;
|
||||
}
|
||||
for (UserModel user : users) {
|
||||
if (user.getScreenName().compareTo("test.user") != 0 && user.getScreenName().compareTo(currUser) != 0) { //skip test.user & current user
|
||||
String thumbnailURL = "";
|
||||
|
|
Loading…
Reference in New Issue