Using mod_assign_get_assignments to get assignment info

Using mod_assign_get_assignments to get assignment info

by Michael Hughes -
Number of replies: 3
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

I've run up against a mod_assign webservice issue.

We're wanting to use mod_assign_get_assignments() to to provide information (primarily the moodle IDs of the activities) to an external system so that system can then extract the grades (using mod_assign_get_grades()).

It would appear that the web service is using the enrol_* functions to determine if the calling user can access the course, which means that the web service user has to be enrolled in the class , rather than simply having a non-enrolled role assigned.

The reason that I don't want to enrol the web service user that we have is so that it doesn't appear in the participant list.

Ideas?

Also since I just need a list of ids to pass to assign_get_grades(), this seems to require that the calling user hold the mod/assign:grade grade capability, which kinda opens it up to doing things I'd *rather* it didn't. I think this goes back to the fact that too many capabilities are being used to pull double purposes. Ability to Grade should *not* have anything to do with being able to "view" grades.

Average of ratings: -
In reply to Michael Hughes

Re: Using mod_assign_get_assignments to get assignment info

by Damyon Wiese -
You could also use core_course_get_contents to get the assignments with ids.
In reply to Damyon Wiese

Re: Using mod_assign_get_assignments to get assignment info

by James Ballard -

Running into the same issue and tried both approaches, however core_course_get_contents returns the id as the Course Module id rather than the assignment id. I can't see instance id in the response

Is there a bridging service between course modules and the module instances?

In reply to James Ballard

Re: Using mod_assign_get_assignments to get assignment info

by James Ballard -

I fixed this by adding instance to the web service response: MDL-48551

Will post a patch there tomorrow.