Search in sources :

Example 1 with SubjectsAuthorizationRequest

use of alien4cloud.rest.orchestrator.model.SubjectsAuthorizationRequest in project alien4cloud by alien4cloud.

the class SecuredResourceStepDefinition method iRevokeAccessToTheResourcesTypeToTheGroup.

@Given("^I (successfully\\s)?revoke access to the resources type \"([^\"]*)\" from the group \"([^\"]*)\"$")
public void iRevokeAccessToTheResourcesTypeToTheGroup(String successfully, String resourceType, String groupName, List<String> resourcesNames) throws Throwable {
    SubjectsAuthorizationRequest request = new SubjectsAuthorizationRequest();
    request.setResources(getResourcesIds(resourcesNames));
    request.setDelete(new String[] { Context.getInstance().getGroupId(groupName) });
    String oneResourceName = CollectionUtils.isEmpty(resourcesNames) ? null : resourcesNames.get(0);
    String url = getBatchSecuredResourceBaseURL(resourceType, oneResourceName);
    url += "/groups";
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(url, JsonUtil.toString(request)));
    CommonStepDefinitions.validateIfNeeded(StringUtils.isNotBlank(successfully));
}
Also used : SubjectsAuthorizationRequest(alien4cloud.rest.orchestrator.model.SubjectsAuthorizationRequest) Given(cucumber.api.java.en.Given)

Example 2 with SubjectsAuthorizationRequest

use of alien4cloud.rest.orchestrator.model.SubjectsAuthorizationRequest in project alien4cloud by alien4cloud.

the class SecuredResourceStepDefinition method iGrantAccessToTheResourcesTypeToTheUser.

/**
 * @param successfully
 * @param resourceType
 * @param username
 * @param resourcesNames
 * @throws Throwable
 */
@Given("^I (successfully\\s)?grant access to the resources type \"([^\"]*)\" to the user \"([^\"]*)\"$")
public void iGrantAccessToTheResourcesTypeToTheUser(String successfully, String resourceType, String username, List<String> resourcesNames) throws Throwable {
    SubjectsAuthorizationRequest request = new SubjectsAuthorizationRequest();
    request.setResources(getResourcesIds(resourcesNames));
    request.setCreate(new String[] { username });
    String oneResourceName = CollectionUtils.isEmpty(resourcesNames) ? null : resourcesNames.get(0);
    String url = getBatchSecuredResourceBaseURL(resourceType, oneResourceName);
    url += "/users";
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(url, JsonUtil.toString(request)));
    CommonStepDefinitions.validateIfNeeded(StringUtils.isNotBlank(successfully));
}
Also used : SubjectsAuthorizationRequest(alien4cloud.rest.orchestrator.model.SubjectsAuthorizationRequest) Given(cucumber.api.java.en.Given)

Example 3 with SubjectsAuthorizationRequest

use of alien4cloud.rest.orchestrator.model.SubjectsAuthorizationRequest in project alien4cloud by alien4cloud.

the class SecuredResourceStepDefinition method iGrantAccessToTheResourcesTypeToTheGroup.

@Given("^I (successfully\\s)?grant access to the resources type \"([^\"]*)\" to the group \"([^\"]*)\"$")
public void iGrantAccessToTheResourcesTypeToTheGroup(String successfully, String resourceType, String groupName, List<String> resourcesNames) throws Throwable {
    SubjectsAuthorizationRequest request = new SubjectsAuthorizationRequest();
    request.setResources(getResourcesIds(resourcesNames));
    request.setCreate(new String[] { Context.getInstance().getGroupId(groupName) });
    String oneResourceName = CollectionUtils.isEmpty(resourcesNames) ? null : resourcesNames.get(0);
    String url = getBatchSecuredResourceBaseURL(resourceType, oneResourceName);
    url += "/groups";
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(url, JsonUtil.toString(request)));
    CommonStepDefinitions.validateIfNeeded(StringUtils.isNotBlank(successfully));
}
Also used : SubjectsAuthorizationRequest(alien4cloud.rest.orchestrator.model.SubjectsAuthorizationRequest) Given(cucumber.api.java.en.Given)

Example 4 with SubjectsAuthorizationRequest

use of alien4cloud.rest.orchestrator.model.SubjectsAuthorizationRequest in project alien4cloud by alien4cloud.

the class SecuredResourceStepDefinition method iRevokeAccessToTheResourcesTypeToTheUser.

@Given("^I (successfully\\s)?revoke access to the resources type \"([^\"]*)\" from the user \"([^\"]*)\"$")
public void iRevokeAccessToTheResourcesTypeToTheUser(String successfully, String resourceType, String username, List<String> resourcesNames) throws Throwable {
    SubjectsAuthorizationRequest request = new SubjectsAuthorizationRequest();
    request.setResources(getResourcesIds(resourcesNames));
    request.setDelete(new String[] { username });
    String oneResourceName = CollectionUtils.isEmpty(resourcesNames) ? null : resourcesNames.get(0);
    String url = getBatchSecuredResourceBaseURL(resourceType, oneResourceName);
    url += "/users";
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(url, JsonUtil.toString(request)));
    CommonStepDefinitions.validateIfNeeded(StringUtils.isNotBlank(successfully));
}
Also used : SubjectsAuthorizationRequest(alien4cloud.rest.orchestrator.model.SubjectsAuthorizationRequest) Given(cucumber.api.java.en.Given)

Aggregations

SubjectsAuthorizationRequest (alien4cloud.rest.orchestrator.model.SubjectsAuthorizationRequest)4 Given (cucumber.api.java.en.Given)4