(no description)
File Size: | 274 lines (12 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
check_subscriptions:: (7 methods):
get_name()
execute()
is_user_setup()
user_can_access_course()
get_subscription_from_rowdata()
get_course_from_rowdata()
get_user_from_rowdata()
Class: check_subscriptions - X-Ref
Simple task class responsible for activating, deactivating and removing subscriptions.get_name() X-Ref |
Get a descriptive name for this task. return: string name of the task. |
execute() X-Ref |
Checks all course-level rule subscriptions and activates/deactivates based on current course access. The ordering of checks within the task is important for optimisation purposes. The aim is to be able to make a decision about whether to activate/deactivate each subscription without making unnecessary checks. The ordering roughly follows the context model, starting with system and user checks and moving down to course and course-module only when necessary. For example, if the user is suspended, then any active subscription is made inactive right away. I.e. there is no need to check site-level, course-level or course-module-level permissions. Likewise, if a subscriptions is site-level, there is no need to check course-level and course-module-level permissions. The task performs the following checks, in this order: 1. Check for a suspended user, breaking if suspended. 2. Check for an incomplete (not set up) user, breaking if not fully set up. 3. Check for the required capability in the relevant context, breaking if the capability is not found. 4. Check whether the subscription is site-context, breaking if true. 5. Check whether the user has course access, breaking only if the subscription is not also course-module-level. 6. Check whether the user has course-module access. |
is_user_setup($user) X-Ref |
Determines whether a user is fully set up, using cached results where possible. param: \stdClass $user the user record. return: bool true if the user is fully set up, false otherwise. |
user_can_access_course($user, $course, $capability) X-Ref |
Determines a user's access to a course with a given capability, using cached results where possible. param: \stdClass $user the user record. param: \stdClass $course the course record. param: string $capability the capability to check. return: bool true if the user can access the course with the specified capability, false otherwise. |
get_subscription_from_rowdata($rowdata) X-Ref |
Returns a partial subscription record, created from properties of the supplied recordset row object. Intended to return a minimal record for specific use within this class and in subsequent access control calls only. param: \stdClass $rowdata the row object. return: \stdClass a partial subscription record. |
get_course_from_rowdata($rowdata) X-Ref |
Returns a partial course record, created from properties of the supplied recordset row object. Intended to return a minimal record for specific use within this class and in subsequent access control calls only. param: \stdClass $rowdata the row object. return: \stdClass a partial course record. |
get_user_from_rowdata($rowdata) X-Ref |
Returns a partial user record, created from properties of the supplied recordset row object. Intended to return a minimal record for specific use within this class and in subsequent access control calls only. param: \stdClass $rowdata the row object. return: \stdClass a partial user record. |