Apicurio-studio: La variable d'environnement "APICURIO_SHARE_FOR_EVERYONE" ne fonctionne pas assez bien

Créé le 20 sept. 2019  ·  3Commentaires  ·  Source: Apicurio/apicurio-studio

Salut!
J'essayais l'environnement var APICURIO_SHARE_FOR_EVERYONE .
Je peux voir et modifier les API d'autres utilisateurs, mais cela ne fonctionne pas pour voir " Collaborateurs " ou " Mocks ".

En recherchant la cause, j'ai trouvé que le service "getMocks" ne vérifie pas la propriété "isShareForEveryone()" et renvoie une erreur HTTP 404, car l'utilisateur n'a pas d'autorisations. Idem pour la rubrique "collaborateurs".

ApicurioError

https://github.com/Apicurio/apicurio-studio/blob/master/front-end/studio/src/app/services/apis.service.ts

this.endpoint("/designs/:designId/mocks",

```

public getMocks(apiId : chaîne, de ? : nombre, à ? : nombre): Promesse console.info("[ApisService] Obtention de toutes les simulations pour l'API %s", apiId);

    let getMocksUrl: string = this.endpoint("/designs/:designId/mocks", {
        designId: apiId
    }, {
        start: from,
        end: to
    });

    let options: any = this.options({ "Accept": "application/json" });

    console.info("[ApisService] Fetching API mocks: %s", getMocksUrl);
    return this.httpGet<ApiMock[]>(getMocksUrl, options);
}

> this.endpoint("/designs/:designId/collaborators",

public getCollaborators(apiId: string): Promesse console.info("[ApisService] Obtenir des collaborateurs pour la conception d'API %s", apiId);

    let getCollaboratorsUrl: string = this.endpoint("/designs/:designId/collaborators", {
        designId: apiId
    });
    let options: any = this.options({ "Accept": "application/json" });

    console.info("[ApisService] Fetching collaborator list: %s", getCollaboratorsUrl);
    return this.httpGet<ApiCollaborator[]>(getCollaboratorsUrl, options);
}

**https://github.com/Apicurio/apicurio-studio/blob/master/back-end/hub-api/src/main/java/io/apicurio/hub/api/rest/impl/DesignsResource.java**

> !this.storage.hasWritePermission

@Passer outre
Collection publiquegetMocks(String designId, Integer start, Integer end)
lève ServerError, NotFoundException {
entier de = 0 ;
entier à = 20 ;
if (début != null) {
from = start.intValue();
}
if (fin != null) {
to = end.intValue();
}

    try {
        String user = this.security.getCurrentUser().getLogin();
        if (!this.storage.hasWritePermission(user, designId)) {
            throw new NotFoundException();
        }
        return this.storage.listApiDesignMocks(designId, from, to);
    } catch (StorageException e) {
        throw new ServerError(e);
    }
}

@Passer outre
Collection publiquegetCollaborators(String designId) lève ServerError, NotFoundException {
logger.debug("Récupération de tous les collaborateurs pour l'API : {}", designId);
metrics.apiCall("/designs/{designId}/collaborators", "GET");

    try {
        String user = this.security.getCurrentUser().getLogin();
        if (!this.storage.hasWritePermission(user, designId)) {
            throw new NotFoundException();
        }
        return this.storage.listPermissions(designId);
    } catch (StorageException e) {
        throw new ServerError(e);
    }
}

```

bug

Commentaire le plus utile

Salut! Merci pour votre commentaire, à la recherche du bug, je viens de découvrir que nous utilisions une ancienne version . 0.2.27.
Désolé pour ça.
Je vais mettre à jour l'application.
Vous pouvez ignorer l'erreur.

Merci.

Tous les 3 commentaires

Merci pour le rapport de bogue.

@AguRyan Dans la dernière version, je découvre qu'à l'intérieur de la fonction hasWritePermission() , isShareForEveryone() est coché :

https://github.com/Apicurio/apicurio-studio/blob/v0.2.43.Final/back-end/hub-core/src/main/java/io/apicurio/hub/core/storage/jdbc/JdbcStorage. java#L275

Avez-vous une autre idée de la cause de ce problème ?

Salut! Merci pour votre commentaire, à la recherche du bug, je viens de découvrir que nous utilisions une ancienne version . 0.2.27.
Désolé pour ça.
Je vais mettre à jour l'application.
Vous pouvez ignorer l'erreur.

Merci.

Cette page vous a été utile?
0 / 5 - 0 notes