james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <server-...@james.apache.org>
Subject [jira] [Commented] (JAMES-2149) Create domain mappings via webadmin
Date Mon, 18 Jun 2018 08:11:00 GMT

    [ https://issues.apache.org/jira/browse/JAMES-2149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16515478#comment-16515478
] 

ASF GitHub Bot commented on JAMES-2149:
---------------------------------------

Github user nstdio commented on a diff in the pull request:

    https://github.com/apache/james-project/pull/119#discussion_r195993544
  
    --- Diff: server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainMappingsRoutes.java
---
    @@ -114,28 +126,56 @@ public HaltException removeDomainMapping(Request request, Response
response) {
                 @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500,
                         message = "Internal server error - Something went bad on the server
side.")
         })
    -    public Map<String, List<String>> get(Request request, Response response)
throws RecipientRewriteTableException {
    +    public Map<String, List<String>> getAllMappings(Request request, Response
response) throws RecipientRewriteTableException {
             return recipientRewriteTable.getAllMappings()
                     .entrySet()
                     .stream()
    -                .collect(toImmutableMap(e -> e.getKey().getFixedDomain(),
    -                        e -> e.getValue()
    -                                .select(Mapping.Type.Domain)
    -                                .asStream()
    -                                .map(Mapping::asString)
    -                                .map(Mapping.Type.Domain::withoutPrefix)
    -                                .collect(toImmutableList())
    +                .filter(mappingsEntry -> !mappingsEntry.getValue().isEmpty())
    +                .filter(mappingsEntry -> mappingsEntry.getValue().contains(Mapping.Type.Domain))
    +                .collect(Guavate.toImmutableMap(
    +                        mappingsEntry -> mappingsEntry.getKey().getFixedDomain(),
    +                        mappingsEntry -> toDomainList(mappingsEntry.getValue())
                     ));
         }
     
    -    private void doMapping(final Request request, final ThrowingBiConsumer<MappingSource,
Domain> op) {
    -        MappingSource fromDomain = createDomainOrThrow()
    +    @GET
    +    @Path(SPECIFIC_MAPPING_PATH)
    +    @ApiOperation(value = "Lists mappings for specific domain.")
    +    @ApiImplicitParams({
    +            @ApiImplicitParam(required = true, dataType = "string", name = FROM_DOMAIN,
paramType = "path")
    +    })
    +    @ApiResponses(value = {
    +            @ApiResponse(code = HttpStatus.OK_200, message = "Domain mappings.", responseContainer
= "List"),
    +            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "Not existing mappings."),
    +            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500,
    +                    message = "Internal server error - Something went bad on the server
side.")
    +    })
    +    public List<String> getMapping(Request request, Response response) throws RecipientRewriteTableException
{
    +        final MappingSource mappingSource = mappingSourceFrom(request);
    --- End diff --
    
    I should change the IDE preferences on that 👍


> Create domain mappings via webadmin
> -----------------------------------
>
>                 Key: JAMES-2149
>                 URL: https://issues.apache.org/jira/browse/JAMES-2149
>             Project: James Server
>          Issue Type: New Feature
>          Components: webadmin
>    Affects Versions: master
>            Reporter: Tellier Benoit
>            Priority: Major
>              Labels: feature, newbie
>
> Nowadays, the Rewrite Table engine supports domain redirections. That is to say any@domain.com
will be rewritten as any@otherDomain.com.
> However, such a feature is not exposed via webadmin.
> You will need to :
>  - Create a new **DomainMappingsRoutes** in webadmin-data
>  - You will expose in this routes, using directly RecipientsRewriteTable, the endpoitns
for adding, removing and listing domain mappings.
> {code:java}
> GET /domainMappings/
> {"fromDomain1":"toDomain1", "fromDomain2": "toDomain2"}
> PUT /domainMappings/fromDomain
> "toDomain"
> DELETE /domainMappings/fromDomain
> "toDomain"
> {code}
> You will write a test class from your endpoints. See *GroupsRoutesTest*.
> Don't hesitate to ask for help on the *Gitter* chat.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message