How to get over error 40 “Access Denied — You do not have access” in SugarCRM?

半世苍凉 提交于 2019-12-11 03:49:22

问题


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":"email1=ychaouche@feeder.fr",
"order_by":"",
"offset":0,
"select_fields":[],
"link_name_to_fields_array":[],
"max_results":0,
"deleted":false}

I get this as a result :

"{"name":"Access Denied","number":40,"description":"You do not have access"}"

Edit

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.


回答1:


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 = 'ychaouche@feeder.fr'
)   

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 : 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 = 'ychaouche@feeder.fr'
)  
"
"order_by":"",
"offset":0,
"select_fields":[],
"link_name_to_fields_array":[],
"max_results":0,
"deleted":false}


来源:https://stackoverflow.com/questions/13456931/how-to-get-over-error-40-access-denied-you-do-not-have-access-in-sugarcrm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!