ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 28 of file class.ilECSRemoteUserRepository.php.

References $DIC.

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

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 73 of file class.ilECSRemoteUserRepository.php.

References exists().

78  : void {
79  if (!$this->exists($sid, $mid, $usr_id)) {
80  $next_id = $this->db->nextId('ecs_remote_user');
81  $query = 'INSERT INTO ecs_remote_user (eru_id, sid, mid, usr_id, remote_usr_id) ' .
82  'VALUES( ' .
83  $this->db->quote($next_id) . ', ' .
84  $this->db->quote($sid, 'integer') . ', ' .
85  $this->db->quote($mid, 'integer') . ', ' .
86  $this->db->quote($usr_id, 'integer') . ', ' .
87  $this->db->quote($remote_usr_id, 'text') . ' ' .
88  ')';
89  $this->db->manipulate($query);
90  }
91  }
exists(int $sid, int $mid, int $usr_id)
Check if entry exists for user.
+ 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 92 of file class.ilECSRemoteUserRepository.php.

References remoteUserExists().

97  : void {
98  if (!$this->remoteUserExists($sid, $mid, $remote_usr_id)) {
99  $next_id = $this->db->nextId('ecs_remote_user');
100  $query = 'INSERT INTO ecs_remote_user (eru_id, sid, mid, usr_id, remote_usr_id) ' .
101  'VALUES( ' .
102  $this->db->quote($next_id) . ', ' .
103  $this->db->quote($sid, 'integer') . ', ' .
104  $this->db->quote($mid, 'integer') . ', ' .
105  $this->db->quote($usr_id, 'integer') . ', ' .
106  $this->db->quote($remote_usr_id, 'text') . ' ' .
107  ')';
108  $this->db->manipulate($query);
109  }
110  }
remoteUserExists(int $sid, int $mid, string $remote_usr_id)
+ 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 38 of file class.ilECSRemoteUserRepository.php.

References $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by createIfNotExisting().

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

◆ getECSRemoteUserById()

ilECSRemoteUserRepository::getECSRemoteUserById ( int  $remoteUserId)

Read data set.

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

References $res, ilDBConstants\FETCHMODE_OBJECT, and null.

Referenced by getECSRemoteUserByRemoteId(), and getECSRemoteUserByUsrId().

114  : ?ilECSRemoteUser
115  {
116  $query = 'SELECT * FROM ecs_remote_user ' .
117  'WHERE eru_id = ' . $this->db->quote($remoteUserId, 'integer');
118  $res = $this->db->query($query);
119  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
120  return new ilECSRemoteUser(
121  $remoteUserId,
122  (int) $row->sid,
123  (int) $row->mid,
124  (int) $row->usr_id,
125  $row->remote_usr_id
126  );
127  }
128  return null;
129  }
$res
Definition: ltiservices.php:66
Storage of ecs remote user.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 148 of file class.ilECSRemoteUserRepository.php.

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

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

◆ getECSRemoteUserByUsrId()

ilECSRemoteUserRepository::getECSRemoteUserByUsrId ( int  $a_usr_id)

Get instance for usr_id.

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

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

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

◆ remoteUserExists()

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

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

References $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by createIfRemoteUserNotExisting().

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

Field Documentation

◆ $db

ilDBInterface ilECSRemoteUserRepository::$db
private

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


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