From 0027d6d0adb26f783d4bbffdec7e5f63d6e5a5b2 Mon Sep 17 00:00:00 2001 From: Jan Vonka Date: Thu, 3 Jan 2008 15:06:07 +0000 Subject: [PATCH] MT fixes to provide initial support for tenant-specific guests - explicit guest access is required, such as "guest@tenant1" (note: implicit/anonymous guest access can only login to the default domain) - also fixes issue with "Show All" users, when logged in as a tenant admin git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7748 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- source/java/org/alfresco/web/bean/NavigationBean.java | 2 +- .../org/alfresco/web/bean/repository/Repository.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/source/java/org/alfresco/web/bean/NavigationBean.java b/source/java/org/alfresco/web/bean/NavigationBean.java index b59053797a..3f1c841cf0 100644 --- a/source/java/org/alfresco/web/bean/NavigationBean.java +++ b/source/java/org/alfresco/web/bean/NavigationBean.java @@ -652,7 +652,7 @@ public class NavigationBean */ public boolean getIsGuest() { - return Application.getCurrentUser(FacesContext.getCurrentInstance()).getUserName().equals(PermissionService.GUEST_AUTHORITY); + return Repository.getIsGuest(FacesContext.getCurrentInstance()); } /** diff --git a/source/java/org/alfresco/web/bean/repository/Repository.java b/source/java/org/alfresco/web/bean/repository/Repository.java index 4e44ba6f1e..cdedd98c17 100644 --- a/source/java/org/alfresco/web/bean/repository/Repository.java +++ b/source/java/org/alfresco/web/bean/repository/Repository.java @@ -58,6 +58,7 @@ import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.Path; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; @@ -666,6 +667,16 @@ public final class Repository return personNodes; } + /** + * @return true if we are currently the special Guest user + */ + public static boolean getIsGuest(FacesContext context) + { + TenantService tenantService = (TenantService)FacesContextUtils.getRequiredWebApplicationContext(context).getBean("tenantService"); + String userName = Application.getCurrentUser(context).getUserName(); + return tenantService.getBaseNameUser(userName).equalsIgnoreCase(PermissionService.GUEST_AUTHORITY); + } + /** * Convert a property of unknown type to a String value. A native String value will be * returned directly, else toString() will be executed, null is returned as null.