MT - fix AR-2036

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8124 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-01-30 14:16:50 +00:00
parent c13dfc051e
commit e1abbcc7a4
6 changed files with 91 additions and 10 deletions

View File

@@ -190,7 +190,8 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
}
/**
* Set the system user as the current user.
* Set the system user as the current user
* note: for MT, will set to default domain only
*
* @return Authentication
*/
@@ -201,6 +202,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
/**
* Get the name of the system user
* note: for MT, will get system for default domain only
*
* @return String
*/
@@ -208,10 +210,22 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
{
return AuthenticationUtil.SYSTEM_USER_NAME;
}
/**
* Is this the system user ?
*
* @return boolean
*/
public boolean isSystemUserName(String userName)
{
return ((userName != null) && tenantService.getBaseNameUser(userName).equals(getSystemUserName()));
}
/**
* Get the name of the Guest User
* note: for MT, will get guest for default domain only
*
* @return String
*/
public String getGuestUserName()
{

View File

@@ -96,6 +96,10 @@ public interface AuthenticationComponent
*/
public String getSystemUserName();
/**
* True if this is the System user ?
*/
public boolean isSystemUserName(String userName);
/**
* Get the name of the guest user

View File

@@ -174,12 +174,7 @@ public class AuthenticationServiceImpl implements AuthenticationService
public boolean isCurrentUserTheSystemUser()
{
String userName = getCurrentUserName();
if ((userName != null) && userName.equals(authenticationComponent.getSystemUserName()))
{
return true;
}
return false;
return authenticationComponent.isSystemUserName(getCurrentUserName());
}
public void authenticateAsGuest() throws AuthenticationException

View File

@@ -304,9 +304,24 @@ public class ChainingAuthenticationComponentImpl implements AuthenticationCompon
{
return AuthenticationUtil.SYSTEM_USER_NAME;
}
/**
* If any implementation supports System then System is allowed
*/
public boolean isSystemUserName(String userName)
{
for (AuthenticationComponent authComponent : getUsableAuthenticationComponents())
{
if (authComponent.isSystemUserName(userName))
{
return true;
}
}
return false;
}
/**
* If any implementation supoprts guest then huest is allowed
* If any implementation supports guest then guest is allowed
*/
public boolean guestUserAuthenticationAllowed()
{