Tsugi

Membership
in package

The launching user's membership in the current context (lti_membership).

Built from the same LTI session row as User and Context after launch or login.

LMS tools cache a populated instance per context via Cache::setContext at self::CACHE_LOCATION (effective numeric role, viewDueDates, optional id).

Table of Contents

Constants

CACHE_LOCATION  : mixed = 'lti_membership'
Session cache slot for {@see ensureInSession()} (one Membership per context, no TTL).

Properties

$id  : mixed
Primary key in lti_membership when present in the session row.
$launch  : Launch|false
$role  : mixed
Effective role in the current context (numeric; see LTIX::ROLE_* constants).
$viewDueDates  : mixed
When set by ensureInSession(), mirrors lti_membership.viewDueDates (user may see due dates).

Methods

ensureInSession()  : self
Load or reuse context-scoped session cache for this user in one lti_membership SELECT (plus ownership query when role must be resolved and membership is not already instructor-level).
invalidateSessionCache()  : mixed
Drop cached membership for a context (e.g. after login or membership changes).
isInstructor()  : mixed
True if effective role is instructor or administrator (>= LTIX::ROLE_INSTRUCTOR).

Constants

CACHE_LOCATION

Session cache slot for {@see ensureInSession()} (one Membership per context, no TTL).

public mixed CACHE_LOCATION = 'lti_membership'

Properties

$id

Primary key in lti_membership when present in the session row.

public mixed $id = null

$role

Effective role in the current context (numeric; see LTIX::ROLE_* constants).

public mixed $role = null

Omitted from the session row until it is known.

When loaded by ensureInSession(), this is max(role, role_override) from the row, or LTIX::ROLE_INSTRUCTOR when the user owns the context or its key, or 0.

$viewDueDates

When set by ensureInSession(), mirrors lti_membership.viewDueDates (user may see due dates).

public mixed $viewDueDates = null

Methods

ensureInSession()

Load or reuse context-scoped session cache for this user in one lti_membership SELECT (plus ownership query when role must be resolved and membership is not already instructor-level).

public static ensureInSession(int $context_id, int $user_id) : self
Parameters
$context_id : int
$user_id : int
Return values
self

invalidateSessionCache()

Drop cached membership for a context (e.g. after login or membership changes).

public static invalidateSessionCache(mixed $context_id) : mixed
Parameters
$context_id : mixed

isInstructor()

True if effective role is instructor or administrator (>= LTIX::ROLE_INSTRUCTOR).

public isInstructor() : mixed

        
On this page

Search results