你好!
我正在尝试环境变量 APICURIO_SHARE_FOR_EVERYONE 。
我可以查看和编辑来自其他用户的 API,但无法查看“协作者”或“模拟”。
搜索原因,我发现服务“getMocks”没有检查属性“isShareForEveryone()”并返回 404 HTTP 错误状态,因为用户没有权限。 “合作者”部分也是如此。
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): 承诺
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
@覆盖
公共收藏
抛出服务器错误,NotFoundException {
int from = 0;
整数 = 20;
如果(开始!= null){
from = start.intValue();
}
如果(结束!= 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);
}
}
@覆盖
公共收藏
logger.debug("正在检索 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);
}
}
``
感谢您的错误报告。
@AguRyan在最新版本中,我发现在hasWritePermission()
函数中,检查了isShareForEveryone()
:
您对导致此问题的原因有任何其他想法吗?
你好! 感谢您的评论,正在寻找错误,我才发现我们使用的是旧版本。 0.2.27。
对于那个很抱歉。
我会更新应用程序。
您可以忽略该错误。
谢谢。
最有用的评论
你好! 感谢您的评论,正在寻找错误,我才发现我们使用的是旧版本。 0.2.27。
对于那个很抱歉。
我会更新应用程序。
您可以忽略该错误。
谢谢。