From d4b7650088e2dd6ed7484ed92ca357e5fba57eb8 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Mon, 6 Jun 2016 11:13:37 +0000 Subject: [PATCH] Merged HEAD (5.2) to 5.2.N (5.2.1) 127898 adavis: Reverse Merge WITHOUT mergeinfo a commit that was merged to HEAD via API-STRIKES-BACK and 5.2.N! 127890 Merged 5.2.N (5.2.1) to HEAD (5.2) 127465 aleahu: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1) 127454 jkaabimofrad: MNT-16224, RA-1093: Fixed Quickshare issue where deleting a shared node didn't remove the 'shared' aspect. The fix also takes care of the shared nodes that have been deleted but not yet restored, as well as, shared nodes that have already been restored from the trashcan (allow the user to un-share). - ENDED UP WITH DUPLICATE CODE ALREADY MERGED BY: 127615 Merged API-STRIKES-BACK (5.2.0) to HEAD (5.2) 127462 jkaabimofrad: Merged 5.1.N (5.1.2) to API-STRIKES-BACK (5.2.0) 127454 jkaabimofrad: MNT-16224, RA-1093: Fixed Quickshare issue where deleting a shared node didn't remove the 'shared' aspect. The fix also takes care of the shared nodes that have been deleted but not yet restored, as well as, shared nodes that have already been restored from the trashcan (allow the user to un-share). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@127900 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/quickshare-services-context.xml | 3 - .../quickshare/QuickShareServiceImpl.java | 80 ------------------- 2 files changed, 83 deletions(-) diff --git a/config/alfresco/quickshare-services-context.xml b/config/alfresco/quickshare-services-context.xml index 920763d318..e53367597d 100644 --- a/config/alfresco/quickshare-services-context.xml +++ b/config/alfresco/quickshare-services-context.xml @@ -77,9 +77,6 @@ - - - diff --git a/source/java/org/alfresco/repo/quickshare/QuickShareServiceImpl.java b/source/java/org/alfresco/repo/quickshare/QuickShareServiceImpl.java index e2dc845b27..ad5aa3653f 100644 --- a/source/java/org/alfresco/repo/quickshare/QuickShareServiceImpl.java +++ b/source/java/org/alfresco/repo/quickshare/QuickShareServiceImpl.java @@ -144,43 +144,10 @@ public class QuickShareServiceImpl implements QuickShareService, private SiteService siteService; private AuthorityService authorityService; - private SearchService searchService; - private SiteService siteService; - private AuthorityService authorityService; private boolean enabled; private String defaultEmailSender; private ClientAppConfig clientAppConfig; - /** - * Spring configuration - * - * @param searchService the searchService to set - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * Spring configuration - * - * @param siteService the siteService to set - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * Spring configuration - * - * @param authorityService the authorityService to set - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - /** * Set the attribute service */ @@ -837,54 +804,7 @@ public class QuickShareServiceImpl implements QuickShareService, }, tenantDomain); } - @Override - public boolean canDeleteSharedLink(NodeRef nodeRef, String sharedByUserId) - { - boolean canDeleteSharedLink = false; - String currentUser = AuthenticationUtil.getFullyAuthenticatedUser(); - String siteName = getSiteName(nodeRef); - boolean isSharedByCurrentUser = currentUser.equals(sharedByUserId); - - if (siteName != null) - { - // node belongs to a site - current user must be a manager or collaborator or someone who shared the link - String role = siteService.getMembersRole(siteName, currentUser); - if (isSharedByCurrentUser || (role != null && (role.equals(SiteModel.SITE_MANAGER) || role.equals(SiteModel.SITE_COLLABORATOR)))) - { - canDeleteSharedLink = true; - } - } - else if (isSharedByCurrentUser || (authorityService.isAdminAuthority(currentUser))) - { - // node does not belongs to a site - current user must be the person who shared the link or an admin - canDeleteSharedLink = true; - } - - return canDeleteSharedLink; - } - - private String getSiteName(NodeRef nodeRef) - { - NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef(); - while (parent != null && !nodeService.getType(parent).equals(SiteModel.TYPE_SITE)) - { - // check that we can read parent name - String parentName = (String) nodeService.getProperty(parent, ContentModel.PROP_NAME); - - if (nodeService.getPrimaryParent(nodeRef) != null) - { - parent = nodeService.getPrimaryParent(parent).getParentRef(); - } - } - - if (parent == null) - { - return null; - } - - return nodeService.getProperty(parent, ContentModel.PROP_NAME).toString(); - } @Override public void sendEmailNotification(final QuickShareEmailRequest emailRequest) {