fetch_course_roles: Fetch roles assigned to users in a course

Description Usage Arguments Details Value

Description

Returns roles assigned to users in the Moodle database. Parameters allow filtering and control over role inheritance.

Usage

1
2
fetch_course_roles(course_id, user_ids, inherit = TRUE, shape = "wide", ...,
  con = get_session_con())

Arguments

course_id

A single integer corresponding to a courseid in the database.

user_ids

A vector of integers corresponding to userids enrolled in the course specified above.

inherit

A single logical value specifying whether to include roles from context levels greater than course-level (TRUE) or to only use course-level roles (FALSE).

shape

A single string specifying what shape the returned data should have. "wide" output has one row per input userid and a column for each possible role. "long" output has one row per role assignment and multiple columns of information.

...

Potential future args.

con

A database connection object, using the session connection by default.

Details

Roles apply to a specific context (e.g. course-specific or system-wide) and can be inherited from a parent context. Data is returned in long format and only includes users with roles in the specified conditions. In the case of duplicate roles (same role given to same user, potentially a different context level), only the earlier role assignment is included.

Currently, only system- and course-level roles are supported. Currently Friday Institute is not using "course category"-level and user-level roles, which are between system- and course-levels, so they are not currently supported.

Duplicate role assignments may exist if a user was enrolled more than once, e.g. course 72 used manual enrollment as a way to assign groups after survey enrollment had already occurred.

Value

A tibble in long format with one row per role assignment.


TheFridayInstitute/fimoodler documentation built on May 28, 2019, 9:37 a.m.