LTI Integration Library 5.1.4
PHP class library for building LTI integrations
 
Loading...
Searching...
No Matches
User Class Reference

Class to represent a platform user. More...

+ Inheritance diagram for User:

Public Member Functions

 __construct ()
 Class constructor.
 
void initialize ()
 Initialise the user.
 
void initialise ()
 Initialise the user.
 
void setNames (string $firstname, string $lastname, string $fullname, ?string $middlename=null)
 Set the user's name.
 
void setEmail (?string $email, ?string $defaultEmail=null)
 Set the user's email address.
 
bool isLearner ()
 Check if the user is a learner.
 
bool isInstructor ()
 Check if the user is an instructor.
 
bool isContentDeveloper ()
 Check if the user is a content developer.
 
bool isTeachingAssistant ()
 Check if the user is a teaching assistant.
 
bool isManager ()
 Check if the user is a manager.
 
bool isMember ()
 Check if the user is a member.
 
bool isOfficer ()
 Check if the user is an officer.
 
bool isStaff ()
 Check if the user is staff.
 
bool isMentor ()
 Check if the user is a mentor.
 
bool isAdmin ()
 Check if the user is an administrator (at any of the system, institution or context levels).
 

Public Attributes

const PRINCIPAL_ROLES
 List of principal roles for LTI 1.3.
 
string $firstname = ''
 User's first name.
 
string $middlename = ''
 User's middle name.
 
string $lastname = ''
 User's last name (surname or family name).
 
string $fullname = ''
 User's fullname.
 
string $sourcedId = null
 User's sourcedId.
 
string $username = null
 User's username.
 
string $email = ''
 User's email address.
 
string $image = ''
 User's image URI.
 
array $roles = []
 Roles for user.
 
array $groups = []
 Groups for user.
 
string $ltiUserId = null
 user ID as supplied in the last connection request.
 

Static Public Attributes

static bool $allowEmptyName = false
 Allow user name field to be empty?
 

Detailed Description

Class to represent a platform user.

Author
Stephen P Vickers steph.nosp@m.en@s.nosp@m.pvsof.nosp@m.twar.nosp@m.eprod.nosp@m.ucts.nosp@m..com
Licence: http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Class constructor.

Reimplemented in UserResult.

Member Function Documentation

◆ initialise()

void initialise ( )

Initialise the user.

Synonym for initialize().

◆ initialize()

void initialize ( )

Initialise the user.

Reimplemented in UserResult.

◆ isAdmin()

bool isAdmin ( )

Check if the user is an administrator (at any of the system, institution or context levels).

Returns
bool True if the user has a role of administrator

◆ isContentDeveloper()

bool isContentDeveloper ( )

Check if the user is a content developer.

Returns
bool True if the user has a context role of ContentDeveloper

Referenced by User\isTeachingAssistant().

◆ isInstructor()

bool isInstructor ( )

Check if the user is an instructor.

Returns
bool True if the user has a context role of Instructor

Referenced by User\isTeachingAssistant().

◆ isLearner()

bool isLearner ( )

Check if the user is a learner.

Returns
bool True if the user has a context role of Learner

◆ isManager()

bool isManager ( )

Check if the user is a manager.

Returns
bool True if the user has a context role of Manager

◆ isMember()

bool isMember ( )

Check if the user is a member.

Returns
bool True if the user has a context role of Member

◆ isMentor()

bool isMentor ( )

Check if the user is a mentor.

Returns
bool True if the user has a context role of Mentor

◆ isOfficer()

bool isOfficer ( )

Check if the user is an officer.

Returns
bool True if the user has a context role of Officer

◆ isStaff()

bool isStaff ( )

Check if the user is staff.

Returns
bool True if the user has a context role of Instructor, ContentDeveloper or TeachingAssistant

◆ isTeachingAssistant()

bool isTeachingAssistant ( )

Check if the user is a teaching assistant.

Returns
bool True if the user has a context role of TeachingAssistant

References User\isContentDeveloper(), User\isInstructor(), and User\isTeachingAssistant().

Referenced by User\isTeachingAssistant().

◆ setEmail()

void setEmail ( ?string $email,
?string $defaultEmail = null )

Set the user's email address.

Parameters
stringnull$emailEmail address value
string | null$defaultEmailValue to use if no email is provided (optional, default is none)

◆ setNames()

void setNames ( string $firstname,
string $lastname,
string $fullname,
?string $middlename = null )

Set the user's name.

Parameters
string$firstnameUser's first name.
string$lastnameUser's last name.
string$fullnameUser's full name.
string | null$middlenameUser's middle name (optional, default is none).