mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
126530 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 123162 jvonka: ACE-5113: Platform - OwnableService - when setting owner check that username currently exists (at time of property update) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126874 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
@@ -51,7 +51,9 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.NoSuchPersonException;
|
||||
import org.alfresco.service.cmr.security.OwnableService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
@@ -76,6 +78,7 @@ public class OwnableServiceImpl implements
|
||||
private TenantService tenantService;
|
||||
private Set<String> storesToIgnorePolicies = Collections.emptySet();
|
||||
private RenditionService renditionService;
|
||||
private PersonService personService;
|
||||
|
||||
public OwnableServiceImpl()
|
||||
{
|
||||
@@ -127,6 +130,11 @@ public class OwnableServiceImpl implements
|
||||
this.renditionService = renditionService;
|
||||
}
|
||||
|
||||
public void setPersonService(PersonService personService)
|
||||
{
|
||||
this.personService = personService;
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
PropertyCheck.mandatory(this, "nodeService", nodeService);
|
||||
@@ -134,6 +142,7 @@ public class OwnableServiceImpl implements
|
||||
PropertyCheck.mandatory(this, "nodeOwnerCache", nodeOwnerCache);
|
||||
PropertyCheck.mandatory(this, "policyComponent", policyComponent);
|
||||
PropertyCheck.mandatory(this, "renditionService", renditionService);
|
||||
PropertyCheck.mandatory(this, "personService", personService);
|
||||
}
|
||||
|
||||
public void init()
|
||||
@@ -278,6 +287,25 @@ public class OwnableServiceImpl implements
|
||||
|
||||
if (!EqualsHelper.nullSafeEquals(pb, pa))
|
||||
{
|
||||
if (pa != null)
|
||||
{
|
||||
String username = (String) pa;
|
||||
NodeRef personNodeRef = null;
|
||||
|
||||
// validate that user authentication exists
|
||||
if (authenticationService.authenticationExists(username))
|
||||
{
|
||||
// validate that person exists
|
||||
// note: will attempt to create missing person, if allowed - may throw NoSuchPersonException
|
||||
personNodeRef = personService.getPerson(username, true);
|
||||
}
|
||||
|
||||
if (personNodeRef == null)
|
||||
{
|
||||
throw new NoSuchPersonException(username);
|
||||
}
|
||||
}
|
||||
|
||||
nodeOwnerCache.remove(nodeRef);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user