Web services, user tokens and user rights

Re: Web services, user tokens and user rights

by Vijay N -
Number of replies: 1

Hi Bjorn,

 

I was wondering if you can explain how you setup the web service and how the code looks. This will give us an idea of how it is functioning.

 

Thanks

Vijay

In reply to Vijay N

Re: Web services, user tokens and user rights

by Björn Fisseler -

Hi Vijay,

actually I'm in the testing phase and use "Postman" (a Chrome app) for testing the webservice via REST. So there isn't much code.

For the webservice, I setup a new user, a new role, a new webservice, and I added several functions, and yes, all the rights are set appropriatly.

The I do the following (via Postman):

  • retrieve the user token for user A1
  • mod_forum_get_forum_discussions:
    mymoodleserver.com/webservice/rest/server.php?wstoken=tokenA1&wsfunction=mod_forum_get_forum_discussions&forumids[0]=65

The problem is, as I tried to explain in my first post, that this call of the webservice sends back a list with all discussions in the forum with id=65. When user A1 logs in via the regular web front-end, he only sees the postings of his group.

The webservice function "mod_forum_get_forum_discussions" seems to ignore the group settings when called with a user token. Or do you have any other ideas?