Merged V3.2 to HEAD

17542: Fix ETHREEOH-3390 - "Could not load activities list" - for usernames with upper-case characters


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17549 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2009-11-18 14:29:07 +00:00
parent f351590801
commit 512e7c8cb5
2 changed files with 44 additions and 27 deletions

View File

@@ -170,7 +170,7 @@ public class ActivityServiceImpl implements ActivityService
feedUserId = feedUserId.toLowerCase();
}
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
String currentUser = getCurrentUser();
if (! ((currentUser == null) ||
(currentUser.equals(AuthenticationUtil.getSystemUserName())) ||
(authorityService.isAdminAuthority(currentUser)) ||
@@ -279,12 +279,13 @@ public class ActivityServiceImpl implements ActivityService
{
ParameterCheck.mandatory("feedControl", feedControl);
String userId = AuthenticationUtil.getFullyAuthenticatedUser();
if (! userNamesAreCaseSensitive)
String userId = getCurrentUser();
if (userId == null)
{
userId = userId.toLowerCase();
throw new AlfrescoRuntimeException("Current user " + userId + " is not permitted to set feed control");
}
try
{
if (! existsFeedControl(feedControl))
@@ -305,7 +306,7 @@ public class ActivityServiceImpl implements ActivityService
*/
public List<FeedControl> getFeedControls()
{
String userId = AuthenticationUtil.getFullyAuthenticatedUser();
String userId = getCurrentUser();
return getFeedControlsImpl(userId);
}
@@ -315,7 +316,13 @@ public class ActivityServiceImpl implements ActivityService
public List<FeedControl> getFeedControls(String userId)
{
ParameterCheck.mandatoryString("userId", userId);
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
if (! userNamesAreCaseSensitive)
{
userId = userId.toLowerCase();
}
String currentUser = getCurrentUser();
if ((currentUser == null) || ((! currentUser.equals(AuthenticationUtil.getSystemUserName())) && (! currentUser.equals(userId)) && (! authorityService.isAdminAuthority(currentUser))))
{
@@ -329,11 +336,6 @@ public class ActivityServiceImpl implements ActivityService
{
ParameterCheck.mandatoryString("userId", userId);
if (! userNamesAreCaseSensitive)
{
userId = userId.toLowerCase();
}
try
{
List<FeedControlEntity> feedControlDaos = feedControlDAO.selectFeedControls(userId);
@@ -360,10 +362,11 @@ public class ActivityServiceImpl implements ActivityService
{
ParameterCheck.mandatory("feedControl", feedControl);
String userId = AuthenticationUtil.getFullyAuthenticatedUser();
if (! userNamesAreCaseSensitive)
String userId = getCurrentUser();
if (userId == null)
{
userId = userId.toLowerCase();
throw new AlfrescoRuntimeException("Current user " + userId + " is not permitted to unset feed control");
}
try
@@ -385,12 +388,7 @@ public class ActivityServiceImpl implements ActivityService
{
ParameterCheck.mandatory("feedControl", feedControl);
String userId = AuthenticationUtil.getFullyAuthenticatedUser();
if (! userNamesAreCaseSensitive)
{
userId = userId.toLowerCase();
}
String userId = getCurrentUser();
try
{
@@ -405,6 +403,18 @@ public class ActivityServiceImpl implements ActivityService
}
}
private String getCurrentUser()
{
String userId = AuthenticationUtil.getFullyAuthenticatedUser();
if ((userId != null) && (! userId.equals(AuthenticationUtil.SYSTEM_USER_NAME)) && (! userNamesAreCaseSensitive))
{
// user names are not case-sensitive
userId = userId.toLowerCase();
}
return userId;
}
private FeedControl getTenantFeedControl(FeedControl feedControl)
{
// TODO