Hi!
I was trying the environment var APICURIO_SHARE_FOR_EVERYONE.
I can see and edit API's from other users, but it's not working to see "Collaborators" or "Mocks".
Searching the cause, i found that the service "getMocks" doesn't check the property "isShareForEveryone()" and return a 404 HTTP Error Satus, becouse the user don't have permisions. Same for the "collaborators" section.
this.endpoint("/designs/:designId/mocks",
```
public getMocks(apiId: string, from?: number, to?: number): Promise
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): Promise
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
@Override
public Collection
throws ServerError, NotFoundException {
int from = 0;
int to = 20;
if (start != null) {
from = start.intValue();
}
if (end != 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);
}
}
@Override
public Collection
logger.debug("Retrieving all collaborators for 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);
}
}
```
Thanks for the bug report.
@AguRyan At the latest release, I find out that inside hasWritePermission()
function, isShareForEveryone()
is checked :
Do you have any other idea about what is the cause of this problem?
Hi! Thanks for your comment, looking for the bug, I just find out that we were using an old version . 0.2.27.
Sorry about that.
I'll update the App.
You can dismiss the error.
Thanks.
Most helpful comment
Hi! Thanks for your comment, looking for the bug, I just find out that we were using an old version . 0.2.27.
Sorry about that.
I'll update the App.
You can dismiss the error.
Thanks.