mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merge branch 'master' into feature/AUTH-85-token-auth
This commit is contained in:
8
pom.xml
8
pom.xml
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-remote-api</artifactId>
|
||||
<name>Alfresco Remote API</name>
|
||||
<version>6.19-TOKEN-AUTH-SNAPSHOT</version>
|
||||
<version>6.21-TOKEN-AUTH-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
@@ -35,9 +35,9 @@
|
||||
<dir.root>${project.build.directory}/alf_data</dir.root>
|
||||
<img.exe>convert</img.exe>
|
||||
|
||||
<dependency.alfresco-repository.version>6.30</dependency.alfresco-repository.version>
|
||||
<dependency.alfresco-core.version>7.0</dependency.alfresco-core.version>
|
||||
<dependency.alfresco-data-model.version>8.1</dependency.alfresco-data-model.version>
|
||||
<dependency.alfresco-repository.version>6.36</dependency.alfresco-repository.version>
|
||||
<dependency.alfresco-core.version>7.1</dependency.alfresco-core.version>
|
||||
<dependency.alfresco-data-model.version>8.2</dependency.alfresco-data-model.version>
|
||||
<dependency.alfresco-pdf-renderer.version>1.1</dependency.alfresco-pdf-renderer.version>
|
||||
<dependency.jackson.version>2.8.10</dependency.jackson.version>
|
||||
|
||||
|
@@ -70,7 +70,7 @@ public class GroupMembersRelation
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title = "Create group membership.")
|
||||
@WebApiParam(name = "entity", title = "A single group member", description = "A single group member, multiple groups members are not supported.", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple = false)
|
||||
@WebApiParam(name = "entity", title = "A single group member", description = "A single group member, multiple groups members are not supported.", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple = false, required = true)
|
||||
public List<GroupMember> create(String groupId, List<GroupMember> entity, Parameters params)
|
||||
{
|
||||
List<GroupMember> result = new ArrayList<>(1);
|
||||
|
@@ -80,7 +80,7 @@ public class GroupsEntityResource implements EntityResourceAction.Read<Group>, E
|
||||
@Override
|
||||
@WebApiDescription(title="Create group", description="Create group")
|
||||
@WebApiParam(name="entity", title="A single group", description="A single group, multiple groups are not supported.",
|
||||
kind= ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false)
|
||||
kind= ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false, required = true)
|
||||
public List<Group> create(List<Group> entity, Parameters parameters)
|
||||
{
|
||||
List<Group> result = new ArrayList<>(1);
|
||||
|
@@ -597,6 +597,8 @@ public class SiteMembershipRequestsImpl implements SiteMembershipRequests
|
||||
throw new PermissionDeniedException();
|
||||
}
|
||||
|
||||
// Workflow doesn't allow changing the role, so a new update may be required if
|
||||
// approval role differs from default one.
|
||||
if (siteMembershipApproval != null && !(siteMembershipApproval.getRole() == null || siteMembershipApproval.getRole().isEmpty()))
|
||||
{
|
||||
String role = siteMembershipApproval.getRole();
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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 Remote API
|
||||
* %%
|
||||
* 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%
|
||||
*/
|
||||
package org.alfresco.rest.api.nodes;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -73,7 +73,7 @@ RelationshipResourceAction.Create<NodeRating>, InitializingBean
|
||||
@Override
|
||||
@WebApiDescription(title="Rate a node for 'nodeId'.")
|
||||
@WebApiParam(name="ratingEntity", title="A single rating", description="A single node rating, multiple ratings are not supported.",
|
||||
kind=ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false)
|
||||
kind=ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false, required = true)
|
||||
public List<NodeRating> create(String nodeId, List<NodeRating> ratingEntity, Parameters parameters)
|
||||
{
|
||||
//There will always be 1 value because allowMultiple=false
|
||||
|
@@ -100,8 +100,8 @@ public class PeopleEntityResource implements EntityResourceAction.ReadById<Perso
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title="Create person", description="Create a person")
|
||||
@WebApiParam(name="entity", title="A single person", description="A single person, multiple people are not supported.",
|
||||
kind= ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false)
|
||||
@WebApiParam(name="persons", title="A single person", description="A single person, multiple people are not supported.",
|
||||
kind= ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false, required = true)
|
||||
public List<Person> create(List<Person> persons, Parameters parameters)
|
||||
{
|
||||
Person p = persons.get(0);
|
||||
|
@@ -112,7 +112,7 @@ public class SiteEntityResource implements EntityResourceAction.Read<Site>,
|
||||
@Override
|
||||
@WebApiDescription(title="Create site", description="Create the default/functional Share site")
|
||||
@WebApiParam(name="entity", title="A single site", description="A single site, multiple sites are not supported.",
|
||||
kind= ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false)
|
||||
kind= ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false, required = true)
|
||||
public List<Site> create(List<Site> entity, Parameters parameters)
|
||||
{
|
||||
List<Site> result = new ArrayList<>(1);
|
||||
|
@@ -63,7 +63,6 @@ import org.alfresco.repo.invitation.InvitationSearchCriteriaImpl;
|
||||
import org.alfresco.repo.management.subsystems.ChildApplicationContextFactory;
|
||||
import org.alfresco.repo.model.filefolder.HiddenAspect;
|
||||
import org.alfresco.repo.model.filefolder.HiddenAspect.Visibility;
|
||||
import org.alfresco.repo.node.index.NodeIndexer;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
@@ -201,7 +200,6 @@ public class RepoService
|
||||
protected InvitationService invitationService;
|
||||
protected LockService lockService;
|
||||
protected CMISConnector cmisConnector;
|
||||
protected NodeIndexer nodeIndexer;
|
||||
protected HiddenAspect hiddenAspect;
|
||||
protected NetworksService networksService;
|
||||
protected NamespaceService namespaceService;
|
||||
@@ -257,7 +255,6 @@ public class RepoService
|
||||
this.invitationService = (InvitationService)applicationContext.getBean("InvitationService");
|
||||
this.lockService = (LockService)applicationContext.getBean("LockService");
|
||||
this.cmisConnector = (CMISConnector)applicationContext.getBean("CMISConnector");
|
||||
this.nodeIndexer = (NodeIndexer)applicationContext.getBean("nodeIndexer");
|
||||
this.activities = (Activities)applicationContext.getBean("activities");
|
||||
this.hiddenAspect = (HiddenAspect)applicationContext.getBean("hiddenAspect");
|
||||
this.networksService = (NetworksService)applicationContext.getBean("networksService");
|
||||
@@ -315,11 +312,6 @@ public class RepoService
|
||||
return allPeople.get(username.toLowerCase());
|
||||
}
|
||||
|
||||
public void disableInTxnIndexing()
|
||||
{
|
||||
nodeIndexer.setDisabled(true);
|
||||
}
|
||||
|
||||
public int getClientVisibilityMask(Client client, Visibility visibility)
|
||||
{
|
||||
return hiddenAspect.getClientVisibilityMask(client, visibility);
|
||||
|
@@ -94,8 +94,6 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author steveglover
|
||||
@@ -145,9 +143,6 @@ public class TestFavourites extends AbstractBaseApiTest
|
||||
|
||||
final Iterator<TestNetwork> networksIt = getTestFixture().networksIterator();
|
||||
|
||||
// Workaround for domain name mismatch in lucene indexing that occurs when this test runs.
|
||||
repoService.disableInTxnIndexing();
|
||||
|
||||
transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@SuppressWarnings("synthetic-access")
|
||||
|
@@ -64,11 +64,12 @@ public class GrassEntityResource implements EntityResourceAction.ReadById<Grass>
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title = "Create some grass")
|
||||
@WebApiParam(name = "entity", title = "The grass.", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT, required=false, allowMultiple = false)
|
||||
public List<Grass> create(List<Grass> entity, Parameters parameters)
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void delete(String id, Parameters parameters)
|
||||
{
|
||||
|
@@ -65,6 +65,7 @@ public class JsonJacksonTests
|
||||
static JacksonHelper jsonHelper = null;
|
||||
|
||||
public static final String FARMER_JSON = "{\"name\":\"Giles\",\"created\":\"2012-03-23T15:56:18.552+0000\",\"age\":54,\"id\":\"1234A3\",\"farm\":\"LARGE\"}";
|
||||
public static final String GRASS_JSON = "{\"id\":\"grass\",\"color\":\"green\"}";
|
||||
public static final String COLLECTION_START = "[ ";
|
||||
public static final String COLLECTION_END = " ]";
|
||||
public static final String FARMERS_COLLECTION_JSON = COLLECTION_START + FARMER_JSON + "," + FARMER_JSON + "," + FARMER_JSON + COLLECTION_END;
|
||||
|
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
package org.alfresco.rest.framework.tests.core;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.any;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
@@ -40,6 +39,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringReader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -48,16 +48,20 @@ import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.rest.api.tests.util.MultiPartBuilder;
|
||||
import org.alfresco.rest.api.tests.util.MultiPartBuilder.FileData;
|
||||
import org.alfresco.rest.api.tests.util.MultiPartBuilder.MultiPartRequest;
|
||||
import org.alfresco.rest.framework.core.ResourceInspector;
|
||||
import org.alfresco.rest.framework.core.ResourceLocator;
|
||||
import org.alfresco.rest.framework.core.ResourceMetadata;
|
||||
import org.alfresco.rest.framework.core.ResourceOperation;
|
||||
import org.alfresco.rest.framework.core.ResourceParameter;
|
||||
import org.alfresco.rest.framework.core.exceptions.UnsupportedResourceOperationException;
|
||||
import org.alfresco.rest.framework.jacksonextensions.BeanPropertiesFilter;
|
||||
import org.alfresco.rest.framework.jacksonextensions.JacksonHelper;
|
||||
import org.alfresco.rest.framework.jacksonextensions.RestJsonModule;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.Params;
|
||||
import org.alfresco.rest.framework.tests.api.mocks.Farmer;
|
||||
import org.alfresco.rest.framework.tests.api.mocks.GrassEntityResource;
|
||||
import org.alfresco.rest.framework.tools.ApiAssistant;
|
||||
import org.alfresco.rest.framework.webscripts.ParamsExtractor;
|
||||
import org.alfresco.rest.framework.webscripts.ResourceWebScriptDelete;
|
||||
@@ -234,6 +238,27 @@ public class ParamsExtractorTests
|
||||
assertNotNull(uoe); //Must throw this exception
|
||||
}
|
||||
testExtractOperationParams(templateVars, request, extractor);
|
||||
|
||||
templateVars.clear();
|
||||
Method aMethod = ResourceInspector.findMethod(EntityResourceAction.Create.class, GrassEntityResource.class);
|
||||
ResourceOperation op = ResourceInspector.inspectOperation(GrassEntityResource.class, aMethod, HttpMethod.POST);
|
||||
List<ResourceMetadata> metainfo = ResourceInspector.inspect(GrassEntityResource.class);
|
||||
assertNotNull(op);
|
||||
assertTrue("Create method should have two params", op.getParameters().size() == 2);
|
||||
ResourceParameter singleParam = op.getParameters().get(0);
|
||||
assertTrue(ResourceParameter.KIND.HTTP_BODY_OBJECT.equals(singleParam.getParamType()));
|
||||
assertFalse("Create grass does not support multiple grass creations", singleParam.isAllowMultiple());
|
||||
assertFalse(singleParam.isRequired());
|
||||
|
||||
// Test context when the request body is null and 'required' webApiParam is false
|
||||
when(request.getHeader("content-length")).thenReturn("0");
|
||||
params = extractor.extractParams(metainfo.get(0), request);
|
||||
assertNotNull(params);
|
||||
|
||||
// Test context when the request body is provided and 'required' property is false
|
||||
when(content.getReader()).thenReturn(new StringReader(JsonJacksonTests.GRASS_JSON));
|
||||
params = extractor.extractParams(metainfo.get(0), request);
|
||||
assertNotNull(params);
|
||||
}
|
||||
|
||||
private Params testExtractOperationParams(Map<String, String> templateVars, WebScriptRequest request, ParamsExtractor extractor)
|
||||
|
Reference in New Issue
Block a user