mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-9178 Add REST API for deauthorizing (#3169)
* ACS-9178 Set peopleEntityResource bean id * ACS-9178 Add the 'deauthorizeUser' operation * ACS-9178 Add 'deauthorizeUser' to Rest API * ACS-9178 Add test * ACS-9178 Fix PMD * ACS-9178 Fix deauthorize API tests --------- Co-authored-by: Gerard Olenski <gerard.olenski@hyland.com>
This commit is contained in:
@@ -437,6 +437,15 @@ public class People extends ModelRequest<People>
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deauthorize a user
|
||||
*/
|
||||
public void deauthorizeUser()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.POST, "people/{personId}/deauthorize", this.person.getUsername(), restWrapper.getParameters());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update avatar image PUT call on 'people/{nodeId}/children
|
||||
*/
|
||||
@@ -514,4 +523,4 @@ public class People extends ModelRequest<People>
|
||||
return people.getFavorites();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,40 @@
|
||||
package org.alfresco.rest.people.deauthorization.community;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
|
||||
/**
|
||||
* Verifies API behavior in community edition. Should be excluded in enterprise edition.
|
||||
*/
|
||||
@Test
|
||||
public class DeauthorizeSanityTests extends RestTest
|
||||
{
|
||||
private UserModel userModel;
|
||||
private UserModel adminUser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation()
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY})
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE}, executionType = ExecutionType.SANITY,
|
||||
description = "Check if de-authorization is not implemented in Community Edition")
|
||||
public void deauthorizationIsNotImplementedInCommunityEdition()
|
||||
{
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(userModel).deauthorizeUser();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).deauthorizeUser();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_IMPLEMENTED);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user