ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLocalUser Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilLocalUser:

Public Member Functions

 __construct (int $a_parent_id)
 
 setParentId (int $a_parent_id)
 
 getParentId ()
 

Static Public Member Functions

static _getFolderIds (bool $access_with_orgunit=false)
 
static _getAllUserIds (int $a_filter=0)
 
static _getUserFolderId ()
 

Data Fields

ilDBInterface $db
 
int $parent_id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Helper class for local user accounts (in categories)

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 24 of file class.ilLocalUser.php.

Constructor & Destructor Documentation

◆ __construct()

ilLocalUser::__construct ( int  $a_parent_id)

Definition at line 29 of file class.ilLocalUser.php.

References $DIC, and $ilDB.

31  {
32  global $DIC;
33 
34  $ilDB = $DIC['ilDB'];
35 
36  $this->db = $ilDB;
37  $this->parent_id = $a_parent_id;
38  }
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ _getAllUserIds()

static ilLocalUser::_getAllUserIds ( int  $a_filter = 0)
static
Parameters
int$a_filter
Returns
int[]

Definition at line 92 of file class.ilLocalUser.php.

References $DIC, $ilDB, $query, $res, and ILIAS\Repository\int().

Referenced by ilLocalUserGUI\assignSave(), ilObjCategoryGUI\assignSaveObject(), ilObjUserFolderGUI\getActionUserIds(), ilLocalUserGUI\performDeleteUsers(), ilObjCategoryGUI\performDeleteUsersObject(), and ilObjUserFolderGUI\viewObject().

94  : array {
95  global $DIC;
96 
97  $ilDB = $DIC['ilDB'];
98  switch ($a_filter) {
99  case 0:
100  if (self::_getFolderIds()) {
101  $where = "WHERE " . $ilDB->in("time_limit_owner", self::_getFolderIds(), false, "integer") . " ";
102  } else {
103  return [];
104  }
105 
106  break;
107 
108  default:
109  $where = "WHERE time_limit_owner = " . $ilDB->quote($a_filter, "integer") . " ";
110 
111  break;
112  }
113 
114  $query = "SELECT usr_id FROM usr_data " . $where;
115  $res = $ilDB->query($query);
116 
117  $users = [];
118  while ($row = $ilDB->fetchObject($res)) {
119  $users[] = (int) $row->usr_id;
120  }
121 
122  return $users;
123  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getFolderIds()

static ilLocalUser::_getFolderIds ( bool  $access_with_orgunit = false)
static
Parameters
bool$access_with_orgunit
Returns
int[]

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

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), ilObjUserFolder\ORG_OP_EDIT_USER_ACCOUNTS, and USER_FOLDER_ID.

Referenced by ilUserTableGUI\getItems(), ilUserTableGUI\getUserIdsForFilter(), ilUserFilter\init(), and ilUserTableGUI\initFilter().

56  : array {
57  global $DIC;
58 
59  $ilDB = $DIC['ilDB'];
60  $access = $DIC->access();
61  $rbacsystem = $DIC['rbacsystem'];
62  $parent = [];
63 
64  $query = "SELECT DISTINCT(time_limit_owner) as parent_id FROM usr_data ";
65 
66  $res = $ilDB->query($query);
67  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
68  // Workaround for users with time limit owner "0".
69  if (!$row->parent_id || (int) $row->parent_id === USER_FOLDER_ID) {
70  if ($rbacsystem->checkAccess('read', USER_FOLDER_ID) ||
71  ($access_with_orgunit && $access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, USER_FOLDER_ID))) {
72  $parent[] = (int) $row->parent_id;
73  }
74  continue;
75  }
76 
77  if ($rbacsystem->checkAccess('read_users', $row->parent_id) ||
78  ($access_with_orgunit && $access->checkPositionAccess(ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $row->parent_id))
79  || $rbacsystem->checkAccess('cat_administrate_users', $row->parent_id)) {
80  if ($row->parent_id) {
81  $parent[] = (int) $row->parent_id;
82  }
83  }
84  }
85  return $parent ?: [];
86  }
$res
Definition: ltiservices.php:69
const USER_FOLDER_ID
Definition: constants.php:33
global $DIC
Definition: feed.php:28
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getUserFolderId()

static ilLocalUser::_getUserFolderId ( )
static

Definition at line 125 of file class.ilLocalUser.php.

Referenced by ilObjUserFolderGUI\getActionUserIds(), and ilObjUserFolderGUI\viewObject().

125  : int
126  {
127  return 7;
128  }
+ Here is the caller graph for this function:

◆ getParentId()

ilLocalUser::getParentId ( )

Definition at line 45 of file class.ilLocalUser.php.

References $parent_id.

45  : int
46  {
47  return $this->parent_id;
48  }

◆ setParentId()

ilLocalUser::setParentId ( int  $a_parent_id)

Definition at line 40 of file class.ilLocalUser.php.

40  : void
41  {
42  $this->parent_id = $a_parent_id;
43  }

Field Documentation

◆ $db

ilDBInterface ilLocalUser::$db

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

◆ $parent_id

int ilLocalUser::$parent_id

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

Referenced by getParentId().


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