mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
78608: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud) 78477: Merged DEV to V4.2-BUG-FIX (4.2.4) 76926 : MNT-11931 : Exception when opening Document Details with QuickShare disabled - Test that quick share webscripts returns 403 if quick share is disabled 76939 : MNT-11931 : Exception when opening Document Details with QuickShare disabled - Implement quick share enabled web script. Don't display quick share link if quick share is turned off 78462 : MNT-11931 : Exception when opening Document Details with QuickShare disabled - Use SingletonValueProcessorExtension to check if quick share is enabled git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@82619 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
<webscript>
|
||||||
|
<shortname>QuickShare - indicates is enabled</shortname>
|
||||||
|
<description>
|
||||||
|
<![CDATA[
|
||||||
|
Unauthenticated: indicates if QuickShare enabled.
|
||||||
|
]]>
|
||||||
|
</description>
|
||||||
|
<url>/quickshare/enabled</url>
|
||||||
|
<format default="json" />
|
||||||
|
<authentication>none</authentication>
|
||||||
|
</webscript>
|
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"enabled" : ${enabled?string}
|
||||||
|
}
|
@@ -1747,6 +1747,10 @@
|
|||||||
|
|
||||||
<bean id="org.alfresco.repository.quickshare.abstract" class="org.alfresco.repo.web.scripts.quickshare.AbstractQuickShareContent" abstract="true">
|
<bean id="org.alfresco.repository.quickshare.abstract" class="org.alfresco.repo.web.scripts.quickshare.AbstractQuickShareContent" abstract="true">
|
||||||
<property name="quickShareService" ref="QuickShareService" />
|
<property name="quickShareService" ref="QuickShareService" />
|
||||||
|
<property name="enabled" value="${system.quickshare.enabled}" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="webscript.org.alfresco.repository.quickshare.enabled-noauth.get" class="org.alfresco.repo.web.scripts.quickshare.QuickShareEnabledGet" parent="org.alfresco.repository.quickshare.abstract">
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- unauthenticated (note: equivalent to authenticated "metadata.get" (limited version with thumbnail data - see below) -->
|
<!-- unauthenticated (note: equivalent to authenticated "metadata.get" (limited version with thumbnail data - see below) -->
|
||||||
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.web.scripts.quickshare;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.extensions.webscripts.Cache;
|
||||||
|
import org.springframework.extensions.webscripts.Status;
|
||||||
|
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QuickShare/PublicView
|
||||||
|
*
|
||||||
|
* GET web script to get property system.quickshare.enabled value
|
||||||
|
*
|
||||||
|
* @author sergey.shcherbovich
|
||||||
|
* @since 4.2
|
||||||
|
*/
|
||||||
|
public class QuickShareEnabledGet extends AbstractQuickShareContent
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected Map<String, Object> executeImpl(final WebScriptRequest req, Status status, Cache cache)
|
||||||
|
{
|
||||||
|
Map<String, Object> model = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
model.put("enabled", isEnabled());
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.web.scripts.quickshare;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||||
|
import org.springframework.extensions.webscripts.GUID;
|
||||||
|
import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class tests QuickShare REST API with disabled QuickShare feature
|
||||||
|
*
|
||||||
|
* @author sergey.shcherbovich
|
||||||
|
* @since 4.2
|
||||||
|
*/
|
||||||
|
public class QuickShareTurnedOffRestApiTest extends BaseWebScriptTest
|
||||||
|
{
|
||||||
|
private static final String APPLICATION_JSON = "application/json";
|
||||||
|
private final static String SHARE_URL = "/api/internal/shared/share/{node_ref}";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setUp() throws Exception
|
||||||
|
{
|
||||||
|
setCustomContext("classpath:alfresco/quick-share-turned-off-test-context.xml");
|
||||||
|
|
||||||
|
super.setUp();
|
||||||
|
|
||||||
|
getServer().getApplicationContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testQuickShareDisabled() throws IOException
|
||||||
|
{
|
||||||
|
String testNodeRef = "workspace://SpacesStore/" + GUID.generate();
|
||||||
|
sendRequest(new PostRequest(SHARE_URL.replace("{node_ref}", testNodeRef), "", APPLICATION_JSON), 403, AuthenticationUtil.getAdminUserName());
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN 2.0//EN' 'http://www.springframework.org/dtd/spring-beans-2.0.dtd'>
|
||||||
|
<beans>
|
||||||
|
<bean id="org.alfresco.repository.quickshare.abstract" class="org.alfresco.repo.web.scripts.quickshare.AbstractQuickShareContent" abstract="true">
|
||||||
|
<property name="quickShareService" ref="QuickShareService" />
|
||||||
|
<property name="enabled" value="false" />
|
||||||
|
</bean>
|
||||||
|
</beans>
|
Reference in New Issue
Block a user