Compare commits

...

28 Commits

Author SHA1 Message Date
rrajoria
2526218bdb create Reset Password Test Case 2023-03-22 12:18:20 +05:30
rrajoria
4d717e0d89 create Reset Password Test Case 2023-03-22 12:16:06 +05:30
rrajoria
dbc6407f66 create Reset Password Test Case 2023-03-22 11:45:00 +05:30
rrajoria
401614db8a create Reset Password Test Case 2023-03-21 20:15:35 +05:30
rrajoria
79fe89c7f1 create Reset Password Test Case 2023-03-21 19:19:12 +05:30
rrajoria
a60547a4f0 create Reset Password Test Case 2023-03-21 18:55:44 +05:30
rrajoria
0517eb6605 create Reset Password Test Case 2023-03-21 18:53:26 +05:30
rrajoria
eae11c4de3 create Reset Password Test Case 2023-03-21 18:09:16 +05:30
rrajoria
6885b817e1 create Reset Password Test Case 2023-03-21 18:07:22 +05:30
Mohinish Sah
91f3edf8e9 incorporated review comments 2023-03-02 22:10:54 +05:30
Mohinish Sah
479724365e incorporated review comments 2023-03-02 22:04:50 +05:30
Mohinish Sah
bb1d5899d9 Merge remote-tracking branch 'origin/master' into feature/ACA-4619-Self-service-User-password-reset-ADW 2023-03-02 21:46:53 +05:30
Mohinish Sah
7ab5e8afd0 Updated the client App name 2023-03-01 18:45:08 +05:30
Mohinish Sah
5107fdfe41 resolved review comments 2023-03-01 12:45:15 +05:30
Alfresco CI User
9ab2ec65df [force] Force release for 2023-01-01. 2023-01-01 00:03:31 +00:00
Travis CI User
0f20b08ca2 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-25 00:09:40 +00:00
Travis CI User
41530a1d34 [maven-release-plugin][skip ci] prepare release 20.49 2022-12-25 00:09:37 +00:00
Alfresco CI User
7616468c54 [force] Force release for 2022-12-25. 2022-12-25 00:03:09 +00:00
Travis CI User
ab101c8698 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-22 12:35:34 +00:00
Travis CI User
31c9a92fd6 [maven-release-plugin][skip ci] prepare release 20.48 2022-12-22 12:35:31 +00:00
Antonio Felix
d785b100df Fix/mnt 23290 slow group membership (#1637)
* MNT-23290 - Change query to get the root groups
2022-12-22 11:48:55 +00:00
Travis CI User
3b25edefd1 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-20 09:25:30 +00:00
Mohinish Sah
f59ff23a45 Rebase Branch 2022-12-08 16:26:44 +05:30
rrajoria
5e2f1db714 ACA-4619: Forgot Password Changes 2022-12-08 16:21:29 +05:30
rrajoria
67ee2efc60 ACA-4619: Forgot Password Changes 2022-12-08 16:21:29 +05:30
MohinishSah
1e7dc6ed8d update Gdrive version 2022-11-14 10:54:40 +05:30
rrajoria
e5ea6db30c ACA-4619: Forgot Password Changes 2022-11-09 18:11:16 +05:30
rrajoria
78a613b1de ACA-4619: Forgot Password Changes 2022-11-09 18:10:29 +05:30
39 changed files with 354 additions and 83 deletions

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-amps</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-parent</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<build>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-parent</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -47,6 +47,7 @@ rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPaths=RM.Re
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getStoreArchiveNode=RM_ABSTAIN
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.restoreNode=RM_ABSTAIN
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsWithoutParentAssocsOfType=RM_ABSTAIN
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.findAssocsNotLinkedByTwoOtherAssocs=RM_ABSTAIN
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeRef=RM.Read.0
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsByPropertyValue=RM.Read.0,AFTER_RM.FilterNode
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.countChildAssocs=RM.Read.0

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<build>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-amps</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<dependencies>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Data model classes
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -714,6 +714,18 @@ public interface NodeService
final NodeRef parent,
final QName assocTypeQName);
/**
* Gets the list of the localnames of the child associations without parent node
*
* @param parent
* the parent node reference
* @return a list of the local names of the child associations
*/
@Auditable(parameters = {"parent"})
public List<String> findAssocsNotLinkedByTwoOtherAssocs(
final NodeRef parent);
/**
* Create a peer association between two nodes.
* <p/>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<dependencies>

View File

@@ -9,6 +9,6 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
</project>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<organization>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<developers>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<developers>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-community-repo</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Alfresco Community Repo Parent</name>
@@ -148,7 +148,7 @@
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
<url>https://github.com/Alfresco/alfresco-community-repo</url>
<tag>20.47</tag>
<tag>HEAD</tag>
</scm>
<distributionManagement>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<dependencies>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.47</version>
<version>20.50-SNAPSHOT</version>
</parent>
<dependencies>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -894,6 +894,8 @@ public interface NodeDAO extends NodeBulkLoader
Serializable nodeValue,
ChildAssocRefQueryCallback resultsCallback);
public abstract List<String> selectAssocsNotLinkedByTwoOtherAssocs(
Long parentNodeId);
/**
* Used by the re-encryptor to re-encrypt encryptable properties with a new encryption key.
*/

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -139,6 +139,8 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
private static final String SELECT_CHILD_ASSOC_OF_PARENT_BY_NAME = "alfresco.node.select_ChildAssocOfParentByName";
private static final String SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_PARENT_ASSOCS_OF_TYPE =
"alfresco.node.select_ChildAssocsOfParentWithoutParentAssocsOfType";
private static final String SELECT_ASSOCS_NOT_LINKED_BY_TWO_OTHER_ASSOCS = "alfresco.node.select_AssocsNotLinkedByTwoOtherAssocs";
private static final String SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_NODE_ASSOCS_OF_TYPE =
"alfresco.node.select_ChildAssocsOfParentWithoutNodeAssocsOfType";
private static final String SELECT_PARENT_ASSOCS_OF_CHILD = "alfresco.node.select_ParentAssocsOfChild";
@@ -1415,11 +1417,23 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
assoc.setOrdered(resultsCallback.orderResults());
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
template.select(SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_PARENT_ASSOCS_OF_TYPE, assoc, resultHandler);
resultsCallback.done();
}
public List<String> selectAssocsNotLinkedByTwoOtherAssocs(
Long parentNodeId)
{
ChildAssocEntity assoc = new ChildAssocEntity();
// Parent
NodeEntity parentNode = new NodeEntity();
parentNode.setId(parentNodeId);
assoc.setParentNode(parentNode);
// Type QName
return template.selectList(SELECT_ASSOCS_NOT_LINKED_BY_TWO_OTHER_ASSOCS, assoc);
}
@Override
public List<Node> selectChildAssocsWithoutNodeAssocsOfTypes(Long parentNodeId, Long minNodeId, Long maxNodeId, Set<QName> assocTypeQNames)
{

View File

@@ -2133,7 +2133,16 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
// done
return results;
}
@Extend(traitAPI=NodeServiceTrait.class,extensionAPI=NodeServiceExtension.class)
public List<String> findAssocsNotLinkedByTwoOtherAssocs(NodeRef parent)
{
// Get the parent node
Pair<Long, NodeRef> nodePair = getNodePairNotNull(parent);
Long parentNodeId = nodePair.getFirst();
return nodeDAO.selectAssocsNotLinkedByTwoOtherAssocs(parentNodeId);
}
/**
* Specific properties <b>not</b> supported by {@link #getChildAssocsByPropertyValue(NodeRef, QName, Serializable)}
*/

View File

@@ -504,6 +504,21 @@ public class ResetPasswordServiceImpl implements ResetPasswordService
return UrlUtil.replaceShareUrlPlaceholder(url, sysAdminParams);
}
private String getRepoBaseUrl(String url, String propName)
{
if (url == null)
{
LOGGER.warn("The url for the property [" + propName + "] is not configured.");
return "";
}
if (url.endsWith("/"))
{
url = url.substring(0, url.length() - 1);
}
return UrlUtil.replaceRepoBaseUrlPlaceholder(url, sysAdminParams);
}
protected String getResetPasswordEmailTemplate(ClientApp clientApp)
{
return clientApp.getProperty("requestResetPasswordTemplatePath");
@@ -522,20 +537,27 @@ public class ResetPasswordServiceImpl implements ResetPasswordService
StringBuilder sb = new StringBuilder(100);
String pageUrl = clientApp.getProperty("resetPasswordPageUrl");
if (StringUtils.isEmpty(pageUrl))
{
sb.append(UrlUtil.getShareUrl(sysAdminParams));
LOGGER.warn("'resetPasswordPageUrl' property is not set for the client [" + clientApp.getName()
if(!StringUtils.isEmpty(clientApp.getProperty("workspaceUrl")))
{
String workspaceUrlPlaceholder = clientApp.getProperty("workspaceUrl");
String workSpaceUrl = getRepoBaseUrl(workspaceUrlPlaceholder,"");
sb.append(UrlUtil.replaceWorkSpaceUrlPlaceholder(pageUrl,workSpaceUrl));
LOGGER.warn("Client Name is " + clientApp.getName() + " The url used is " + sb.toString());
/*sb.append("?key=").append(key)
.append("&id=").append(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, id));*/
}
else if(StringUtils.isEmpty(pageUrl)) {
sb.append(UrlUtil.getShareUrl(sysAdminParams));
LOGGER.warn("'resetPasswordPageUrl' property is not set for the client [" + clientApp.getName()
+ "]. The default base url of Share will be used [" + sb.toString() + "]");
}
else
{
// We pass an empty string as we know that the pageUrl is not null
sb.append(getUrl(pageUrl, ""));
}
} else {
// We pass an empty string as we know that the pageUrl is not null
sb.append(getUrl(pageUrl, ""));
}
sb.append("?key=").append(key)
sb.append("?key=").append(key)
.append("&id=").append(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, id));
return sb.toString();

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -48,7 +48,6 @@ import org.alfresco.query.CannedQueryFactory;
import org.alfresco.query.CannedQueryResults;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.repo.cache.AsynchronouslyRefreshedCache;
import org.alfresco.util.cache.RefreshableCacheEvent;
import org.alfresco.util.cache.RefreshableCacheListener;
import org.alfresco.repo.cache.SimpleCache;
@@ -1566,11 +1565,11 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
{
return Collections.<String> emptySet();
}
Collection<ChildAssociationRef> childRefs = nodeService.getChildAssocsWithoutParentAssocsOfType(container, ContentModel.ASSOC_MEMBER);
List<String> rootGroupsNames = nodeService.findAssocsNotLinkedByTwoOtherAssocs(container);
Set<String> authorities = new TreeSet<String>();
for (ChildAssociationRef childRef : childRefs)
for (String rootGroupName : rootGroupsNames)
{
addAuthorityNameIfMatches(authorities, childRef.getQName().getLocalName(), type);
addAuthorityNameIfMatches(authorities, rootGroupName, type);
}
return authorities;
}

View File

@@ -1,28 +1,28 @@
/*
* #%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
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2022 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
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.version;
import java.io.Serializable;
@@ -656,13 +656,13 @@ public class NodeServiceImpl implements NodeService, VersionModel
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
}
/**
* Gets an association by ID.
*
* @param id
* the association id
* @return the association, or <code>null</code> if it does not exist
*/
/**
* Gets an association by ID.
*
* @param id
* the association id
* @return the association, or <code>null</code> if it does not exist
*/
public AssociationRef getAssoc(Long id)
{
return null;
@@ -762,7 +762,15 @@ public class NodeServiceImpl implements NodeService, VersionModel
public Collection<ChildAssociationRef> getChildAssocsWithoutParentAssocsOfType(NodeRef parent, QName assocTypeQName)
{
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
}
}
/**
* @throws UnsupportedOperationException always
*/
public List<String> findAssocsNotLinkedByTwoOtherAssocs(NodeRef parent)
{
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
}
/**
* Gets, converts and adds the intrinsic properties to the current node's properties

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -1467,6 +1467,11 @@ public class VirtualNodeServiceExtension extends VirtualSpringBeanExtension<Node
}
}
@Override
public List<String> findAssocsNotLinkedByTwoOtherAssocs(NodeRef nodeRef){
return getTrait().findAssocsNotLinkedByTwoOtherAssocs(nodeRef);
}
@Override
public void removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
throws InvalidNodeRefException

View File

@@ -41,6 +41,12 @@ public class UrlUtil
public static final Pattern PATTERN = Pattern.compile("\\$\\{shareUrl\\}");
// ${alfrescoUrl} placeholder
public static final Pattern REPO_PATTERN = Pattern.compile("\\$\\{alfrescoUrl\\}");
public static final Pattern REPOBASE_PATTERN = Pattern.compile("\\$\\{repoBaseUrl\\}");
public static final Pattern WORKSPACE_PATTERN = Pattern.compile("\\$\\{workspaceUrl\\}");
/**
* Builds up the Url to Alfresco based on the settings in the
* {@link SysAdminParams}.
@@ -146,4 +152,68 @@ public class UrlUtil
url.append(context);
return url.toString();
}
/**
* Builds up the Url to Adw based on the settings in the
* {@link SysAdminParams}.
* @return Adw Url such as https://col.ab.or.ate/#/
* or http://localhost:8081/#/
*/
public static String getWorkspaceUrl(SysAdminParams sysAdminParams)
{
return buildWorkspaceUrl(
sysAdminParams.getAlfrescoProtocol(),
sysAdminParams.getAlfrescoHost(),
sysAdminParams.getAlfrescoPort());
}
protected static String buildWorkspaceUrl(String workSpaceProtocol, String workspaceHost, int workspacePort) {
StringBuilder workspaceUrl = new StringBuilder();
workspaceUrl.append(workSpaceProtocol);
workspaceUrl.append("://");
workspaceUrl.append(workspaceHost);
if ("http".equals(workSpaceProtocol) && workspacePort == 80)
{
// Not needed
}
else if ("https".equals(workSpaceProtocol) && workspacePort == 443)
{
// Not needed
}
else
{
workspaceUrl.append(':');
workspaceUrl.append(workspacePort);
}
return workspaceUrl.toString();
}
/**
* Replaces the repo base url placeholder, namely {@literal ${repoBaseUrl}}, with <b>workspace</b> url.
*
* @param value the string value which contains the repoBase url placeholder
* @param sysAdminParams the {@code SysAdminParams} object
* @return if the given {@code value} contains share url placeholder,
* the placeholder is replaced with share url; otherwise, the given {@code value} is simply returned
*/
public static String replaceRepoBaseUrlPlaceholder(String value, SysAdminParams sysAdminParams)
{
if (value != null)
{
return REPOBASE_PATTERN.matcher(value).replaceAll(getWorkspaceUrl(sysAdminParams));
}
return value;
}
public static String replaceWorkSpaceUrlPlaceholder(String pageUrl,String workspaceUrl)
{
if (pageUrl != null)
{
return WORKSPACE_PATTERN.matcher(pageUrl).replaceAll(workspaceUrl);
}
return pageUrl;
}
}

View File

@@ -20,6 +20,15 @@ repo.client-app.share.resetPasswordPageUrl=${shareUrl}/page/reset-password
repo.client-app.share.confirmResetPasswordTemplatePath=
### Digital workspace template configurations
repo.client-app.workspace.inviteModeratedTemplatePath=
repo.client-app.workspace.workspaceUrl=workspace
repo.client-app.workspace.templateAssetsUrl=${alfrescoUrl}/images
#repo.client-app.workspace.inviteModeratedTemplatePath=
repo.client-app.workspace.workspaceUrl=${repoBaseUrl}/workspace
repo.client-app.workspace.templateAssetsUrl=${workspaceUrl}/images
# reset password request email template path
repo.client-app.workspace.requestResetPasswordTemplatePath=alfresco/templates/reset-password-email-templates/forgot-password-email-template.ftl
# reset password UI page url
repo.client-app.workspace.resetPasswordPageUrl=${workspaceUrl}/reset-password/
# reset password confirmation email template path
repo.client-app.workspace.confirmResetPasswordTemplatePath=

View File

@@ -1147,6 +1147,20 @@
parentNode.id = #{parentNode.id} and
a.child_node_id IS NULL
</select>
<select id="select_AssocsNotLinkedByTwoOtherAssocs" parameterType="ChildAssoc" resultType="java.lang.String">
select distinct c.qname_localname
from alf_child_assoc c
where c.parent_node_id = #{parentNode.id}
and not exists (
select 1
from alf_child_assoc a
join alf_child_assoc z
on z.parent_node_id = #{parentNode.id}
and z.child_node_id = a.parent_node_id
where c.child_node_id = a.child_node_id
);
</select>
<select id="select_ChildAssocsByPropertyValue" parameterType="ChildProperty" resultMap="result_ChildAssoc">
<include refid="alfresco.node.select_ChildAssoc_Results"/>

View File

@@ -425,6 +425,7 @@
org.alfresco.service.cmr.repository.NodeService.getStoreArchiveNode=ACL_NODE.0.sys:base.Read
org.alfresco.service.cmr.repository.NodeService.restoreNode=ACL_NODE.0.sys:base.DeleteNode,ACL_NODE.1.sys:base.CreateChildren
org.alfresco.service.cmr.repository.NodeService.getChildAssocsWithoutParentAssocsOfType=ACL_NODE.0.sys:base.ReadProperties,AFTER_ACL_NODE.sys:base.ReadProperties
org.alfresco.service.cmr.repository.NodeService.findAssocsNotLinkedByTwoOtherAssocs=ACL_NODE.0.sys:base.ReadProperties,AFTER_ACL_NODE.sys:base.ReadProperties
org.alfresco.service.cmr.repository.NodeService.countChildAssocs=ACL_NODE.0.sys:base.ReadChildren
org.alfresco.service.cmr.repository.NodeService.*=ACL_DENY
</value>

View File

@@ -0,0 +1,12 @@
<html>
<head>
<title>Forgot Password</title>
</head>
<body>
<p>You are receiving this email because you(or someone else) requested the password reset of your account.</p>
<p>Please click on the following link, or paste this url into your browser to complete the process:</p>
<p><a href="${reset_password_url}">${reset_password_url}</a></p>
<p>If you received this in error, you can safely ignore it.</p>
<p>Kind regards</p>
</body>
</html>

View File

@@ -92,6 +92,10 @@ public class ResetPasswordServiceImplTest
private static TestPerson testPerson;
private static EmailUtil emailUtil;
private static TestPerson testPersonForWorkspace;
@BeforeClass
public static void initStaticData() throws Exception
{
@@ -114,9 +118,18 @@ public class ResetPasswordServiceImplTest
.setPassword("password")
.setEmail(userName + "@example.com");
String userNameForWorkspace = "shane.doe" + System.currentTimeMillis();
testPersonForWorkspace = new TestPerson()
.setUserName(userNameForWorkspace)
.setFirstName("Shane")
.setLastName("doe")
.setPassword("password")
.setEmail(userNameForWorkspace + "@example.com");
transactionHelper.doInTransaction((RetryingTransactionCallback<Void>) () ->
{
createUser(testPerson);
createUser(testPersonForWorkspace);
return null;
});
@@ -153,6 +166,86 @@ public class ResetPasswordServiceImplTest
emailUtil.reset();
}
@Test
public void testResetPasswordForClientWorkspace() throws Exception
{
// Try the credential before change of password
authenticateUser(testPersonForWorkspace.userName, testPersonForWorkspace.password);
// Make sure to run as system
AuthenticationUtil.clearCurrentSecurityContext();
AuthenticationUtil.setRunAsUserSystem();
// Request password reset
resetPasswordService.requestReset(testPersonForWorkspace.userName, "workspace");
assertEquals("A reset password email should have been sent.", 1, emailUtil.getSentCount());
// Check the email
MimeMessage msg = emailUtil.getLastEmail();
assertNotNull("There should be an email.", msg);
assertEquals("Should've been only one email recipient.", 1, msg.getAllRecipients().length);
// Check the recipient is the person who requested the reset password
assertEquals(testPersonForWorkspace.email, msg.getAllRecipients()[0].toString());
//Check the sender is what we set as default
assertEquals(DEFAULT_SENDER, msg.getFrom()[0].toString());
// There should be a subject
assertNotNull("There should be a subject.", msg.getSubject());
// Check the default email subject - (check that we are sending the right email)
String emailSubjectKey = getDeclaredField(SendResetPasswordEmailDelegate.class, "EMAIL_SUBJECT_KEY");
assertNotNull(emailSubjectKey);
assertEquals(msg.getSubject(), I18NUtil.getMessage(emailSubjectKey));
// Check the reset password url.
String resetPasswordUrl = (String) emailUtil.getLastEmailTemplateModelValue("reset_password_url");
assertNotNull("Wrong email is sent.", resetPasswordUrl);
// Get the workflow id and key
Pair<String, String> pair = getWorkflowIdAndKeyFromUrl(resetPasswordUrl);
assertNotNull("Workflow Id can't be null.", pair.getFirst());
assertNotNull("Workflow Key can't be null.", pair.getSecond());
emailUtil.reset();
// Now that we have got the email, try to reset the password
ResetPasswordDetails passwordDetails = new ResetPasswordDetails()
.setUserId(testPersonForWorkspace.userName)
.setPassword("newPassword")
.setWorkflowId(pair.getFirst())
.setWorkflowKey(pair.getSecond());
resetPasswordService.initiateResetPassword(passwordDetails);
assertEquals("A reset password confirmation email should have been sent.", 1, emailUtil.getSentCount());
// Check the email
msg = emailUtil.getLastEmail();
assertNotNull("There should be an email.", msg);
assertEquals("Should've been only one email recipient.", 1, msg.getAllRecipients().length);
// Check the recipient is the person who requested the reset password
assertEquals(testPersonForWorkspace.email, msg.getAllRecipients()[0].toString());
// Check the sender is what we set as default
assertEquals(DEFAULT_SENDER, msg.getFrom()[0].toString());
// There should be a subject
assertNotNull("There should be a subject.", msg.getSubject());
// Check the default email subject - (check that we are sending the right email)
emailSubjectKey = getDeclaredField(SendResetPasswordConfirmationEmailDelegate.class, "EMAIL_SUBJECT_KEY");
assertNotNull(emailSubjectKey);
assertEquals(msg.getSubject(), I18NUtil.getMessage(emailSubjectKey));
// Try the old credential
TestHelper.assertThrows(() -> authenticateUser(testPersonForWorkspace.userName, testPersonForWorkspace.password),
AuthenticationException.class,
"As the user changed her password, the authentication should have failed.");
// Try the new credential
authenticateUser(testPersonForWorkspace.userName, "newPassword");
// Make sure to run as system
AuthenticationUtil.clearCurrentSecurityContext();
AuthenticationUtil.setRunAsUserSystem();
emailUtil.reset();
// Try reset again with the used workflow
TestHelper.assertThrows(() -> resetPasswordService.initiateResetPassword(passwordDetails),
InvalidResetPasswordWorkflowException.class,
"The workflow instance is not active (it has already been used).");
assertEquals("No email should have been sent.", 0, emailUtil.getSentCount());
}
@Test
public void testResetPassword() throws Exception
{