ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilECSRemoteUserRepository Class Reference
+ Collaboration diagram for ilECSRemoteUserRepository:

Public Member Functions

 __construct ()
 
 createIfNotExisting (int $sid, int $mid, int $usr_id, string $remote_usr_id)
 Create new remote user entry. More...
 
 createIfRemoteUserNotExisting (int $sid, int $mid, int $usr_id, string $remote_usr_id)
 
 getECSRemoteUserById (int $remoteUserId)
 Read data set. More...
 
 getECSRemoteUserByUsrId (int $a_usr_id)
 Get instance for usr_id. More...
 
 getECSRemoteUserByRemoteId (string $remoteUserId)
 Get instance for remote usr_id (login|external_account) More...
 

Private Member Functions

 exists (int $sid, int $mid, int $usr_id)
 Check if entry exists for user. More...
 
 remoteUserExists (int $sid, int $mid, string $remote_usr_id)
 

Private Attributes

ilDBInterface $db
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilECSRemoteUserRepository::__construct ( )

Definition at line 27 of file class.ilECSRemoteUserRepository.php.

References $DIC.

28  {
29  global $DIC;
30 
31  $this->db = $DIC['ilDB'];
32  }
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ createIfNotExisting()

ilECSRemoteUserRepository::createIfNotExisting ( int  $sid,
int  $mid,
int  $usr_id,
string  $remote_usr_id 
)

Create new remote user entry.

Definition at line 72 of file class.ilECSRemoteUserRepository.php.

References $query, and exists().

77  : void {
78  if (!$this->exists($sid, $mid, $usr_id)) {
79  $next_id = $this->db->nextId('ecs_remote_user');
80  $query = 'INSERT INTO ecs_remote_user (eru_id, sid, mid, usr_id, remote_usr_id) ' .
81  'VALUES( ' .
82  $this->db->quote($next_id) . ', ' .
83  $this->db->quote($sid, 'integer') . ', ' .
84  $this->db->quote($mid, 'integer') . ', ' .
85  $this->db->quote($usr_id, 'integer') . ', ' .
86  $this->db->quote($remote_usr_id, 'text') . ' ' .
87  ')';
88  $this->db->manipulate($query);
89  }
90  }
exists(int $sid, int $mid, int $usr_id)
Check if entry exists for user.
$query
+ Here is the call graph for this function:

◆ createIfRemoteUserNotExisting()

ilECSRemoteUserRepository::createIfRemoteUserNotExisting ( int  $sid,
int  $mid,
int  $usr_id,
string  $remote_usr_id 
)

Definition at line 91 of file class.ilECSRemoteUserRepository.php.

References $query, and remoteUserExists().

96  : void {
97  if (!$this->remoteUserExists($sid, $mid, $remote_usr_id)) {
98  $next_id = $this->db->nextId('ecs_remote_user');
99  $query = 'INSERT INTO ecs_remote_user (eru_id, sid, mid, usr_id, remote_usr_id) ' .
100  'VALUES( ' .
101  $this->db->quote($next_id) . ', ' .
102  $this->db->quote($sid, 'integer') . ', ' .
103  $this->db->quote($mid, 'integer') . ', ' .
104  $this->db->quote($usr_id, 'integer') . ', ' .
105  $this->db->quote($remote_usr_id, 'text') . ' ' .
106  ')';
107  $this->db->manipulate($query);
108  }
109  }
remoteUserExists(int $sid, int $mid, string $remote_usr_id)
$query
+ Here is the call graph for this function:

◆ exists()

ilECSRemoteUserRepository::exists ( int  $sid,
int  $mid,
int  $usr_id 
)
private

Check if entry exists for user.

Definition at line 37 of file class.ilECSRemoteUserRepository.php.

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by createIfNotExisting().

41  : bool {
42  $query = 'SELECT eru_id FROM ecs_remote_user ' .
43  'WHERE sid = ' . $this->db->quote($sid, 'integer') . ' ' .
44  'AND mid = ' . $this->db->quote($mid, 'integer') . ' ' .
45  'AND usr_id = ' . $this->db->quote($usr_id, 'integer');
46  $res = $this->db->query($query);
47  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
48  return (bool) $row->eru_id;
49  }
50  return false;
51  }
$res
Definition: ltiservices.php:69
$query
+ Here is the caller graph for this function:

◆ getECSRemoteUserById()

ilECSRemoteUserRepository::getECSRemoteUserById ( int  $remoteUserId)

Read data set.

Definition at line 113 of file class.ilECSRemoteUserRepository.php.

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by getECSRemoteUserByRemoteId(), and getECSRemoteUserByUsrId().

113  : ?ilECSRemoteUser
114  {
115  $query = 'SELECT * FROM ecs_remote_user ' .
116  'WHERE eru_id = ' . $this->db->quote($remoteUserId, 'integer');
117  $res = $this->db->query($query);
118  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
119  return new ilECSRemoteUser(
120  $remoteUserId,
121  (int) $row->sid,
122  (int) $row->mid,
123  (int) $row->usr_id,
124  $row->remote_usr_id
125  );
126  }
127  return null;
128  }
$res
Definition: ltiservices.php:69
Storage of ecs remote user.
$query
+ Here is the caller graph for this function:

◆ getECSRemoteUserByRemoteId()

ilECSRemoteUserRepository::getECSRemoteUserByRemoteId ( string  $remoteUserId)

Get instance for remote usr_id (login|external_account)

Definition at line 147 of file class.ilECSRemoteUserRepository.php.

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, and getECSRemoteUserById().

147  : ?ilECSRemoteUser
148  {
149  $query = 'SELECT eru_id FROM ecs_remote_user ' .
150  'WHERE remote_usr_id = ' . $this->db->quote($remoteUserId, 'text');
151  $res = $this->db->query($query);
152  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
153  return $this->getECSRemoteUserById($row->eru_id);
154  }
155  return null;
156  }
$res
Definition: ltiservices.php:69
getECSRemoteUserById(int $remoteUserId)
Read data set.
Storage of ecs remote user.
$query
+ Here is the call graph for this function:

◆ getECSRemoteUserByUsrId()

ilECSRemoteUserRepository::getECSRemoteUserByUsrId ( int  $a_usr_id)

Get instance for usr_id.

Definition at line 133 of file class.ilECSRemoteUserRepository.php.

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, and getECSRemoteUserById().

133  : ?ilECSRemoteUser
134  {
135  $query = 'SELECT eru_id FROM ecs_remote_user ' .
136  'WHERE usr_id = ' . $this->db->quote($a_usr_id, 'integer');
137  $res = $this->db->query($query);
138  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
139  return $this->getECSRemoteUserById((int) $row->eru_id);
140  }
141  return null;
142  }
$res
Definition: ltiservices.php:69
getECSRemoteUserById(int $remoteUserId)
Read data set.
Storage of ecs remote user.
$query
+ Here is the call graph for this function:

◆ remoteUserExists()

ilECSRemoteUserRepository::remoteUserExists ( int  $sid,
int  $mid,
string  $remote_usr_id 
)
private

Definition at line 53 of file class.ilECSRemoteUserRepository.php.

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by createIfRemoteUserNotExisting().

57  : bool {
58  $query = 'SELECT eru_id FROM ecs_remote_user ' .
59  'WHERE sid = ' . $this->db->quote($sid, 'integer') . ' ' .
60  'AND mid = ' . $this->db->quote($mid, 'integer') . ' ' .
61  'AND remote_usr_id = ' . $this->db->quote($remote_usr_id, 'text');
62  $res = $this->db->query($query);
63  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
64  return (bool) $row->eru_id;
65  }
66  return false;
67  }
$res
Definition: ltiservices.php:69
$query
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilECSRemoteUserRepository::$db
private

Definition at line 25 of file class.ilECSRemoteUserRepository.php.


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