问题描述
这里是请求参数(url = http://sugarcrm.localhost/service/v4_1/rest.php):
Here are the request params (url = http://sugarcrm.localhost/service/v4_1/rest.php):
method=get_entry_list&input_type=json&response_type=json
&rest_data {"session":"2q67jvlce802e4htsqc94oshkat9henvicvfclprhrbd8ef6k0o0",
"module_name":"Contacts",
"query":"[email protected]",
"order_by":"",
"offset":0,
"select_fields":[],
"link_name_to_fields_array":[],
"max_results":0,
"deleted":false}
我得到了这个结果:
"{"name":"Access Denied","number":40,"description":"You do not have access"}"
编辑
每当子查询格式错误时就会触发此错误,不一定是在无法访问模块时触发,因此应该注意这一点.
This error is fired whenever the subquery is malformed, not necessarily when one doesn't have access to a module, so one should be aware of it.
推荐答案
嗯,我的问题的一种解决方案是用这个查询替换该查询:
Well, one solution to my problem is to replace that query with this one :
contacts.id
IN
(
SELECT email_addr_bean_rel.bean_id
FROM email_addr_bean_rel
JOIN email_addresses
ON email_addr_bean_rel.email_address_id = email_addresses.id
WHERE
email_addresses.email_address = '[email protected]'
)
由于 email1 和 email2 字段似乎不可查询(它们不在 Contacts 表中).解决方法包括通过子查询查询 email_address 表.
Since appearantly the email1 and email2 fields are not queriable (they're not in the Contacts table). The workaround consists of querying the email_address table via a subquery.
EDIT :使整个查询看起来像这样:
EDIT : so that the whole query should look something like this :
method=get_entry_list&input_type=json&response_type=json
&rest_data {"session":"2q67jvlce802e4htsqc94oshkat9henvicvfclprhrbd8ef6k0o0",
"module_name":"Contacts",
"query":
"
contacts.id
IN
(
SELECT email_addr_bean_rel.bean_id
FROM email_addr_bean_rel
JOIN email_addresses
ON email_addr_bean_rel.email_address_id = email_addresses.id
WHERE
email_addresses.email_address = '[email protected]'
)
"
"order_by":"",
"offset":0,
"select_fields":[],
"link_name_to_fields_array":[],
"max_results":0,
"deleted":false}
这篇关于如何克服错误 40“访问被拒绝 -- 您无权访问"在 SugarCRM 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!