Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
tool_uploadcourse\permissions Class Reference

Static Public Member Functions

static check_permission_to_create (array $coursedata)
 Check permission to create course.
 
static check_permission_to_delete (string $shortname)
 Check capabilities to delete a course and to use tool_uploadcourse for it.
 
static check_permission_to_reset (array $coursedata)
 Check if the user is able to reset a course.
 
static check_permission_to_restore (int $do, array $coursedata)
 Check if the user is able to restore the mbz into a course.
 
static check_permission_to_update (array $coursedata)
 Check permission to update the course.
 

Static Protected Member Functions

static check_capability (int $do, array $coursedata, string $capability)
 Check capability in a course (that exists or is about to be created).
 
static check_permission_to_use_uploadcourse_tool (int $catid, ?lang_string $customerror=null)
 Check permission to use tool_uploadcourse in a given category.
 

Member Function Documentation

◆ check_capability()

static tool_uploadcourse\permissions::check_capability ( int $do,
array $coursedata,
string $capability )
staticprotected

Check capability in a course (that exists or is about to be created).

Parameters
int$doone of tool_uploadcourse_course\DO_UPDATE or tool_uploadcourse_course\DO_ADD
array$coursedatadata to update/create course with, must contain either 'id' or 'category' respectively
string$capabilitycapability to check
Return values
lang_string|nullerror string or null

◆ check_permission_to_create()

static tool_uploadcourse\permissions::check_permission_to_create ( array $coursedata)
static

Check permission to create course.

This checks capabilities:

  • to use tool_uploadcourse in the category where course will be created.
  • to create a course.
  • to force course language (if applicable).
  • to set course tags (if applicable).
Parameters
array$coursedatadata to create a course with, always contains 'category'
Return values
lang_string|null

◆ check_permission_to_delete()

static tool_uploadcourse\permissions::check_permission_to_delete ( string $shortname)
static

Check capabilities to delete a course and to use tool_uploadcourse for it.

Parameters
string$shortnamecourse shortname
Return values
lang_string|null

◆ check_permission_to_reset()

static tool_uploadcourse\permissions::check_permission_to_reset ( array $coursedata)
static

Check if the user is able to reset a course.

Capability to use the tool and update the course is already checked earlier.

Parameters
array$coursedatadata to update course with, always contains 'id'
Return values
lang_string|nullerror string or null

◆ check_permission_to_restore()

static tool_uploadcourse\permissions::check_permission_to_restore ( int $do,
array $coursedata )
static

Check if the user is able to restore the mbz into a course.

This method does not need to check if the course can be updated/created, this is checked earlier.

Parameters
int$doone of tool_uploadcourse_course\DO_UPDATE or tool_uploadcourse_course\DO_ADD
array$coursedatadata to update/create course with, must contain either 'id' or 'category' respectively
Return values
lang_string|nullerror string or null

◆ check_permission_to_update()

static tool_uploadcourse\permissions::check_permission_to_update ( array $coursedata)
static

Check permission to update the course.

This checks capabilities:

  • to use tool_uploadcourse in the category where course is in and in the category where it will be moved to (if applicable).
  • to change course category (if applicable).
  • to update course details.
  • to force course language (if applicable).
  • to change course idnumber, shortname, fullname, summary, visibility, tags (if applicable).
Parameters
array$coursedatadata to update a course with, always contains 'id'
Return values
lang_string|null

◆ check_permission_to_use_uploadcourse_tool()

static tool_uploadcourse\permissions::check_permission_to_use_uploadcourse_tool ( int $catid,
?lang_string $customerror = null )
staticprotected

Check permission to use tool_uploadcourse in a given category.

Parameters
int$catid
lang_string | null$customerror
Return values
lang_string|null

The documentation for this class was generated from the following file: