Developer Guide 2: Chat / Writing Controllers and API : PermissionsError in getting agent status

I am getting an error when I try to test the method for getting the agent status in Developer Guide 2: Chat / Writing Controllers and API.

When I enter the following into the URL bar of my browser (used in the tutorial to test):

http://localhost:8000/api/method/website_chat.templates.pages.chat.get_agent_status

...I get this Python traceback talking about a PermissionsError exception being raised.

Any ideas on how to fix this? Thanks.



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/efc2b487-b7a3-422b-a0f0-ed0cd9e2ba26%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
I figured it out on my own eventually. I needed to be logged in as the Administrator user in the same tab before visiting that URL.

On Friday, June 13, 2014 11:55:26 AM UTC-4, Chris Horton wrote:
I am getting an error when I try to test the method for getting the agent status in Developer Guide 2: Chat / Writing Controllers and API.

When I enter the following into the URL bar of my browser (used in the tutorial to test):

http://localhost:8000/api/method/website_chat.templates.pages.chat.get_agent_status

...I get this Python traceback talking about a PermissionsError exception being raised.

Any ideas on how to fix this? Thanks.



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/d5359899-edf8-48dc-8310-65a1a0436b71%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
You should not need admin for that. Is the method whitelisted via frappe.whitelist(allow_guest=True) ?



On 13-Jun-2014, at 9:43 pm, Chris Horton <ch...@thedrainage.com> wrote:

I figured it out on my own eventually. I needed to be logged in as the Administrator user in the same tab before visiting that URL.

On Friday, June 13, 2014 11:55:26 AM UTC-4, Chris Horton wrote:
I am getting an error when I try to test the method for getting the agent status in Developer Guide 2: Chat / Writing Controllers and API.

When I enter the following into the URL bar of my browser (used in the tutorial to test):

http://localhost:8000/api/method/website_chat.templates.pages.chat.get_agent_status

...I get this Python traceback talking about a PermissionsError exception being raised.

Any ideas on how to fix this? Thanks.

-- 
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/d5359899-edf8-48dc-8310-65a1a0436b71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/D72F3066-3F29-444C-B170-171A8AECF906%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.
It should be. I simply copy/pasted it from the tutorial into the chat.py file, including the whitelist decorator:

@frappe.whitelist(allow_guest=True)
def get_agent_status():
    if frappe.get_list("Website Chat Agent", filters={"status":"Active"},
        ignore_permissions=True, limit_page_length=1):
        return "active"
    else:
        return "inactive"

On Friday, June 13, 2014 12:37:43 PM UTC-4, rushabh wrote:
You should not need admin for that. Is the method whitelisted via frappe.whitelist(allow_guest=True) ?



On 13-Jun-2014, at 9:43 pm, Chris Horton <ch...@thedrainage.com> wrote:

I figured it out on my own eventually. I needed to be logged in as the Administrator user in the same tab before visiting that URL.

On Friday, June 13, 2014 11:55:26 AM UTC-4, Chris Horton wrote:
I am getting an error when I try to test the method for getting the agent status in Developer Guide 2: Chat / Writing Controllers and API.

When I enter the following into the URL bar of my browser (used in the tutorial to test):

http://localhost:8000/api/method/website_chat.templates.pages.chat.get_agent_status

...I get this Python traceback talking about a PermissionsError exception being raised.

Any ideas on how to fix this? Thanks.

-- 
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/d5359899-edf8-48dc-8310-65a1a0436b71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/300daaef-1ebc-41bd-adb0-b1400b8be63d%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.