mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Enable cold bootstrap without waking up authentication component. Made ImporterComponent use AuthenticationContext rather than AuthenticationService. Was then able to roll back temporary fix to AuthenticationFilter (from 13673).
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13727 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -40,8 +40,8 @@
|
|||||||
<property name="authorityService">
|
<property name="authorityService">
|
||||||
<ref bean="AuthorityService" />
|
<ref bean="AuthorityService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="authenticationService">
|
<property name="authenticationContext">
|
||||||
<ref bean="AuthenticationService" />
|
<ref bean="authenticationContext" />
|
||||||
</property>
|
</property>
|
||||||
<property name="viewParser">
|
<property name="viewParser">
|
||||||
<ref bean="viewParser" />
|
<ref bean="viewParser" />
|
||||||
@@ -81,8 +81,8 @@
|
|||||||
<property name="authorityService">
|
<property name="authorityService">
|
||||||
<ref bean="AuthorityService" />
|
<ref bean="AuthorityService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="authenticationService">
|
<property name="authenticationContext">
|
||||||
<ref bean="AuthenticationService" />
|
<ref bean="authenticationContext" />
|
||||||
</property>
|
</property>
|
||||||
<property name="viewParser">
|
<property name="viewParser">
|
||||||
<ref bean="viewParser" />
|
<ref bean="viewParser" />
|
||||||
|
@@ -40,6 +40,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.importer.view.NodeContext;
|
import org.alfresco.repo.importer.view.NodeContext;
|
||||||
import org.alfresco.repo.policy.BehaviourFilter;
|
import org.alfresco.repo.policy.BehaviourFilter;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationContext;
|
||||||
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
|
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||||
@@ -59,7 +60,6 @@ import org.alfresco.service.cmr.rule.RuleService;
|
|||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
import org.alfresco.service.cmr.security.AccessPermission;
|
import org.alfresco.service.cmr.security.AccessPermission;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
|
||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
import org.alfresco.service.cmr.security.OwnableService;
|
import org.alfresco.service.cmr.security.OwnableService;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
@@ -107,7 +107,7 @@ public class ImporterComponent
|
|||||||
private RuleService ruleService;
|
private RuleService ruleService;
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
private AuthorityService authorityService;
|
private AuthorityService authorityService;
|
||||||
private AuthenticationService authenticationService;
|
private AuthenticationContext authenticationContext;
|
||||||
private OwnableService ownableService;
|
private OwnableService ownableService;
|
||||||
|
|
||||||
// binding markers
|
// binding markers
|
||||||
@@ -198,11 +198,11 @@ public class ImporterComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param authenticationService authenticationService
|
* @param authenticationContext authenticationContext
|
||||||
*/
|
*/
|
||||||
public void setAuthenticationService(AuthenticationService authenticationService)
|
public void setAuthenticationContext(AuthenticationContext authenticationContext)
|
||||||
{
|
{
|
||||||
this.authenticationService = authenticationService;
|
this.authenticationContext = authenticationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -536,6 +536,7 @@ public class ImporterComponent
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.importer.Importer#importNode(org.alfresco.repo.importer.ImportNode)
|
* @see org.alfresco.repo.importer.Importer#importNode(org.alfresco.repo.importer.ImportNode)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public NodeRef importNode(ImportNode context)
|
public NodeRef importNode(ImportNode context)
|
||||||
{
|
{
|
||||||
// import node
|
// import node
|
||||||
@@ -714,6 +715,7 @@ public class ImporterComponent
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.importer.Importer#end()
|
* @see org.alfresco.repo.importer.Importer#end()
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void end()
|
public void end()
|
||||||
{
|
{
|
||||||
// Bind all node references to destination space
|
// Bind all node references to destination space
|
||||||
@@ -917,6 +919,7 @@ public class ImporterComponent
|
|||||||
* @param properties
|
* @param properties
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private Map<QName, Serializable> bindProperties(ImportNode context)
|
private Map<QName, Serializable> bindProperties(ImportNode context)
|
||||||
{
|
{
|
||||||
Map<QName, Serializable> properties = context.getProperties();
|
Map<QName, Serializable> properties = context.getProperties();
|
||||||
@@ -1261,7 +1264,7 @@ public class ImporterComponent
|
|||||||
NodeRef nodeRef = assocRef.getChildRef();
|
NodeRef nodeRef = assocRef.getChildRef();
|
||||||
|
|
||||||
// Note: non-admin authorities take ownership of new nodes
|
// Note: non-admin authorities take ownership of new nodes
|
||||||
if (!(authorityService.hasAdminAuthority() || authenticationService.isCurrentUserTheSystemUser()))
|
if (!(authenticationContext.isCurrentUserTheSystemUser() || authorityService.hasAdminAuthority()))
|
||||||
{
|
{
|
||||||
ownableService.takeOwnership(nodeRef);
|
ownableService.takeOwnership(nodeRef);
|
||||||
}
|
}
|
||||||
@@ -1269,7 +1272,7 @@ public class ImporterComponent
|
|||||||
// apply permissions
|
// apply permissions
|
||||||
List<AccessPermission> permissions = null;
|
List<AccessPermission> permissions = null;
|
||||||
AccessStatus writePermission = permissionService.hasPermission(nodeRef, PermissionService.CHANGE_PERMISSIONS);
|
AccessStatus writePermission = permissionService.hasPermission(nodeRef, PermissionService.CHANGE_PERMISSIONS);
|
||||||
if (authenticationService.isCurrentUserTheSystemUser() || writePermission.equals(AccessStatus.ALLOWED))
|
if (authenticationContext.isCurrentUserTheSystemUser() || writePermission.equals(AccessStatus.ALLOWED))
|
||||||
{
|
{
|
||||||
permissions = bindPermissions(node.getAccessControlEntries());
|
permissions = bindPermissions(node.getAccessControlEntries());
|
||||||
|
|
||||||
@@ -1449,7 +1452,7 @@ public class ImporterComponent
|
|||||||
// Apply permissions
|
// Apply permissions
|
||||||
List<AccessPermission> permissions = null;
|
List<AccessPermission> permissions = null;
|
||||||
AccessStatus writePermission = permissionService.hasPermission(existingNodeRef, PermissionService.CHANGE_PERMISSIONS);
|
AccessStatus writePermission = permissionService.hasPermission(existingNodeRef, PermissionService.CHANGE_PERMISSIONS);
|
||||||
if (authenticationService.isCurrentUserTheSystemUser() || writePermission.equals(AccessStatus.ALLOWED))
|
if (authenticationContext.isCurrentUserTheSystemUser() || writePermission.equals(AccessStatus.ALLOWED))
|
||||||
{
|
{
|
||||||
boolean inheritPermissions = node.getInheritPermissions();
|
boolean inheritPermissions = node.getInheritPermissions();
|
||||||
if (!inheritPermissions)
|
if (!inheritPermissions)
|
||||||
|
@@ -320,6 +320,16 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
return authenticationContext.isSystemUserName(userName);
|
return authenticationContext.isSystemUserName(userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the current user the system user?
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isCurrentUserTheSystemUser()
|
||||||
|
{
|
||||||
|
return authenticationContext.isCurrentUserTheSystemUser();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the Guest User note: for MT, will get guest for default domain only
|
* Get the name of the Guest User note: for MT, will get guest for default domain only
|
||||||
*
|
*
|
||||||
|
@@ -24,6 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.security.authentication;
|
package org.alfresco.repo.security.authentication;
|
||||||
|
|
||||||
|
import org.alfresco.service.Auditable;
|
||||||
|
|
||||||
import net.sf.acegisecurity.Authentication;
|
import net.sf.acegisecurity.Authentication;
|
||||||
import net.sf.acegisecurity.UserDetails;
|
import net.sf.acegisecurity.UserDetails;
|
||||||
|
|
||||||
@@ -88,6 +90,11 @@ public interface AuthenticationContext
|
|||||||
*/
|
*/
|
||||||
public boolean isSystemUserName(String userName);
|
public boolean isSystemUserName(String userName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the current user the system user?
|
||||||
|
*/
|
||||||
|
public boolean isCurrentUserTheSystemUser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the Guest User. Note: for MT, will get guest for default domain only
|
* Get the name of the Guest User. Note: for MT, will get guest for default domain only
|
||||||
*/
|
*/
|
||||||
|
@@ -102,6 +102,11 @@ public class AuthenticationContextImpl implements AuthenticationContext
|
|||||||
return getSystemUserName().equals(this.tenantService.getBaseNameUser(userName));
|
return getSystemUserName().equals(this.tenantService.getBaseNameUser(userName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCurrentUserTheSystemUser()
|
||||||
|
{
|
||||||
|
return isSystemUserName(getCurrentUserName());
|
||||||
|
}
|
||||||
|
|
||||||
public String getGuestUserName(String tenantDomain)
|
public String getGuestUserName(String tenantDomain)
|
||||||
{
|
{
|
||||||
return this.tenantService.getDomainUser(getGuestUserName(), tenantDomain);
|
return this.tenantService.getDomainUser(getGuestUserName(), tenantDomain);
|
||||||
|
Reference in New Issue
Block a user