我无法访问嵌套原型来禁用它或更改实现逻辑。
以下是Org.json和OrgGroup.json
Org.json
{
"name": "Org",
"plural": "Orgs",
"base": "PersistedModel",
"idInjection": true,
"options": {
"replaceOnPUT": true,
"validateUpsert": false
},
"properties": {
"name": {
"type": "string",
"required": true
}
},
"relations": {
"orgGroup": {
"type": "belongsTo",
"model": "OrgGroup",
"foreignKey": "groupId",
"options": {
"nestRemoting": true
}
}
},
"acls": [],
"methods": {}
}
OrgGroup.json
{
"name": "OrgGroup",
"plural": "OrgGroups",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"name": {
"type": "string",
"required": true
}
},
"relations": {
"orgs": {
"type": "hasMany",
"model": "Org",
"foreignKey": "groupId",
"options": {
"nestRemoting": true
}
}
},
"acls": [],
"methods": {}
}
我有这样的访问方法:
GET /Orgs/{id}/orgGroup
我可以使用'prototype.__get__orgGroup'
但"nestRemoting": true
由于关系而正在按预期创建以下内容:
GET /Orgs/{id}/orgGroup/orgs
GET /Orgs/{id}/orgGroup/orgs/{fk}
PUT /Orgs/{id}/orgGroup/orgs/{fk}
我想访问此嵌套api 1)禁用PUT方法PUT /Orgs/{id}/orgGroup/orgs/{fk}
并为GET /Orgs/{id}/orgGroup/orgs/{fk}
提供acl&#39。但是,我无法做到。我该怎么做?
以下任何一项均无效:
例如:对于嵌套的api GET /Orgs/{id}/orgGroup/orgs
,我尝试过:
prototype._get_orgGroup_orgs
prototype.__get__orgGroup_orgs
prototype.__find__orgGroup_orgs
prototype._find_orgGroup_orgs
__get__orgGroup_orgs
__get__orgGroup__orgs
__get__orgGroupOrgs
答案 0 :(得分:0)
这应该可以解决问题:
Org.disableRemoteMethodByName('prototype.__updateById__ OrgGroups')