ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPortfolioAccessHandler Class Reference

Access handler for portfolio. More...

+ Inheritance diagram for ilPortfolioAccessHandler:
+ Collaboration diagram for ilPortfolioAccessHandler:

Public Member Functions

 __construct ()
 
 checkAccess ($a_permission, $a_cmd, $a_node_id, $a_type="")
 check access for an object More...
 
 checkAccessOfUser ($a_user_id, $a_permission, $a_cmd, $a_node_id, $a_type="")
 check access for an object More...
 
 setPermissions ($a_parent_node_id, $a_node_id)
 Set permissions after creating node/object. More...
 
 addPermission ($a_node_id, $a_object_id, $a_extended_data=null)
 Add permission to node for object. More...
 
 removePermission ($a_node_id, $a_object_id=null)
 Remove permission[s] (for object) to node. More...
 
 getPermissions ($a_node_id)
 Get all permissions to node. More...
 
 hasRegisteredPermission ($a_node_id)
 
 hasGlobalPermission ($a_node_id)
 
 hasGlobalPasswordPermission ($a_node_id)
 
 getObjectsIShare ($a_online_only=true)
 
 getSharedOwners ()
 
 getSharedObjects ($a_owner_id)
 
 getShardObjectsDataForUserIds (array $a_owner_ids)
 
 findSharedObjects (array $a_filter=null, array $a_crs_ids=null, array $a_grp_ids=null)
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getPermissions ($a_node_id)
 Get all permissions to node. More...
 
static getPossibleSharedTargets ()
 
static getSharedNodePassword ($a_node_id)
 
static keepSharedSessionPassword ($a_node_id, $a_password)
 
static getSharedSessionPassword ($a_node_id)
 

Protected Member Functions

 syncProfile ($a_node_id)
 

Protected Attributes

 $lng
 
 $user
 
 $rbacreview
 
 $settings
 
 $db
 
 $access
 

Detailed Description

Access handler for portfolio.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilPersonalDesktopGUI.php 26976 2010-12-16 13:24:38Z akill

Definition at line 19 of file class.ilPortfolioAccessHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ilPortfolioAccessHandler::__construct ( )

Definition at line 51 of file class.ilPortfolioAccessHandler.php.

References $DIC, $lng, settings(), and user().

52  {
53  global $DIC;
54 
55  $this->lng = $DIC->language();
56  $this->user = $DIC->user();
57  $this->rbacreview = $DIC->rbac()->review();
58  $this->settings = $DIC->settings();
59  $this->db = $DIC->database();
60  $this->access = $DIC->access();
61  $lng = $DIC->language();
62  $lng->loadLanguageModule("wsp");
63  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ _getPermissions()

static ilPortfolioAccessHandler::_getPermissions (   $a_node_id)
static

Get all permissions to node.

Parameters
int$a_node_id
Returns
array

Definition at line 268 of file class.ilPortfolioAccessHandler.php.

References $DIC, $ilDB, $res, $row, and array.

Referenced by ilSharedResourceGUI\hasAccess().

269  {
270  global $DIC;
271 
272  $ilDB = $DIC->database();
273 
274  $set = $ilDB->query("SELECT object_id FROM usr_portf_acl" .
275  " WHERE node_id = " . $ilDB->quote($a_node_id, "integer"));
276  $res = array();
277  while ($row = $ilDB->fetchAssoc($set)) {
278  $res[] = $row["object_id"];
279  }
280  return $res;
281  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ addPermission()

ilPortfolioAccessHandler::addPermission (   $a_node_id,
  $a_object_id,
  $a_extended_data = null 
)

Add permission to node for object.

Parameters
int$a_node_id
int$a_object_id
string$a_extended_data

Definition at line 208 of file class.ilPortfolioAccessHandler.php.

References $db, $ilDB, $ilUser, $user, syncProfile(), and time.

209  {
210  $ilDB = $this->db;
212 
213  // current owner must not be added
214  if ($a_object_id == $ilUser->getId()) {
215  return;
216  }
217 
218  $ilDB->manipulate("INSERT INTO usr_portf_acl (node_id, object_id, extended_data, tstamp)" .
219  " VALUES (" . $ilDB->quote($a_node_id, "integer") . ", " .
220  $ilDB->quote($a_object_id, "integer") . "," .
221  $ilDB->quote($a_extended_data, "text") . "," .
222  $ilDB->quote(time(), "integer") . ")");
223 
224  // portfolio as profile
225  $this->syncProfile($a_node_id);
226  }
$ilUser
Definition: imgupload.php:18
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ canBeDelivered()

ilPortfolioAccessHandler::canBeDelivered ( ilWACPath  $ilWACPath)
Parameters
ilWACPath$ilWACPath
Returns
bool

Implements ilWACCheckingClass.

Definition at line 590 of file class.ilPortfolioAccessHandler.php.

References $access, $ilUser, $results, $user, ilObject\_getAllReferences(), ilObject\_lookupType(), checkAccessOfUser(), and ilWACPath\getPath().

591  {
593  $ilAccess = $this->access;
594 
595  if (preg_match("/\\/prtf_([\\d]*)\\//uism", $ilWACPath->getPath(), $results)) {
596  // portfolio (custom)
597  $obj_id = $results[1];
598  if (ilObject::_lookupType($obj_id) == "prtf") {
599  if ($this->checkAccessOfUser($ilUser->getId(), "read", "view", $obj_id, "prtf")) {
600  return true;
601  }
602  }
603  // portfolio template (RBAC)
604  else {
605  $ref_ids = ilObject::_getAllReferences($obj_id);
606  foreach ($ref_ids as $ref_id) {
607  if ($ilAccess->checkAccessOfUser($ilUser->getId(), "read", "view", $ref_id, "prtt", $obj_id)) {
608  return true;
609  }
610  }
611  }
612  }
613 
614  return false;
615  }
checkAccessOfUser($a_user_id, $a_permission, $a_cmd, $a_node_id, $a_type="")
check access for an object
static _getAllReferences($a_id)
get all reference ids of object
$ilUser
Definition: imgupload.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
$results
Definition: svg-scanner.php:47
+ Here is the call graph for this function:

◆ checkAccess()

ilPortfolioAccessHandler::checkAccess (   $a_permission,
  $a_cmd,
  $a_node_id,
  $a_type = "" 
)

check access for an object

Parameters
string$a_permission
string$a_cmd
int$a_node_id
string$a_type(optional)
Returns
bool

Definition at line 74 of file class.ilPortfolioAccessHandler.php.

References $a_type, $ilUser, $user, and checkAccessOfUser().

75  {
77 
78  return $this->checkAccessOfUser($ilUser->getId(), $a_permission, $a_cmd, $a_node_id, $a_type);
79  }
checkAccessOfUser($a_user_id, $a_permission, $a_cmd, $a_node_id, $a_type="")
check access for an object
$a_type
Definition: workflow.php:92
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ checkAccessOfUser()

ilPortfolioAccessHandler::checkAccessOfUser (   $a_user_id,
  $a_permission,
  $a_cmd,
  $a_node_id,
  $a_type = "" 
)

check access for an object

Parameters
integer$a_user_id
string$a_permission
string$a_cmd
int$a_node_id
string$a_type(optional)
Returns
bool

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

References $ilSetting, $ilUser, $rbacreview, $settings, $user, ilGroupParticipants\_getInstanceByObjId(), ilCourseParticipants\_getInstanceByObjId(), ilObject\_lookupType(), ilWorkspaceAccessGUI\PERMISSION_ALL, ilWorkspaceAccessGUI\PERMISSION_ALL_PASSWORD, and ilWorkspaceAccessGUI\PERMISSION_REGISTERED.

Referenced by canBeDelivered(), and checkAccess().

92  {
96 
97  // #20310
98  if (!$ilSetting->get("enable_global_profiles") && $ilUser->getId() == ANONYMOUS_USER_ID) {
99  return false;
100  }
101 
102  // #12059
103  if (!$ilSetting->get('user_portfolios')) {
104  return false;
105  }
106 
107  // :TODO: create permission for parent node with type ?!
108 
109  $pf = new ilObjPortfolio($a_node_id, false);
110  if (!$pf->getId()) {
111  return false;
112  }
113 
114  // portfolio owner has all rights
115  if ($pf->getOwner() == $a_user_id) {
116  return true;
117  }
118 
119  // #11921
120  if (!$pf->isOnline()) {
121  return false;
122  }
123 
124  // other users can only read
125  if ($a_permission == "read" || $a_permission == "visible") {
126  // get all objects with explicit permission
127  $objects = self::_getPermissions($a_node_id);
128  if ($objects) {
129  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
130 
131  // check if given user is member of object or has role
132  foreach ($objects as $obj_id) {
133  switch ($obj_id) {
135  return true;
136 
138  // check against input kept in session
139  if (self::getSharedNodePassword($a_node_id) == self::getSharedSessionPassword($a_node_id) ||
140  $a_permission == "visible") {
141  return true;
142  }
143  break;
144 
146  if ($ilUser->getId() != ANONYMOUS_USER_ID) {
147  return true;
148  }
149  break;
150 
151  default:
152  switch (ilObject::_lookupType($obj_id)) {
153  case "grp":
154  // member of group?
155  if (ilGroupParticipants::_getInstanceByObjId($obj_id)->isAssigned($a_user_id)) {
156  return true;
157  }
158  break;
159 
160  case "crs":
161  // member of course?
162  if (ilCourseParticipants::_getInstanceByObjId($obj_id)->isAssigned($a_user_id)) {
163  return true;
164  }
165  break;
166 
167  case "role":
168  // has role?
169  if ($rbacreview->isAssigned($a_user_id, $obj_id)) {
170  return true;
171  }
172  break;
173 
174  case "usr":
175  // direct assignment
176  if ($a_user_id == $obj_id) {
177  return true;
178  }
179  break;
180  }
181  break;
182  }
183  }
184  }
185  }
186 
187  return false;
188  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
$ilUser
Definition: imgupload.php:18
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findSharedObjects()

ilPortfolioAccessHandler::findSharedObjects ( array  $a_filter = null,
array  $a_crs_ids = null,
array  $a_grp_ids = null 
)

Definition at line 428 of file class.ilPortfolioAccessHandler.php.

References $db, $ilDB, $ilUser, $res, $row, $user, array, ilParticipants\getInstanceByObjId(), getPossibleSharedTargets(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_UNIX, ilWorkspaceAccessGUI\PERMISSION_ALL, ilWorkspaceAccessGUI\PERMISSION_ALL_PASSWORD, and ilWorkspaceAccessGUI\PERMISSION_REGISTERED.

429  {
430  $ilDB = $this->db;
432  if (!$a_filter["acl_type"]) {
433  $obj_ids = $this->getPossibleSharedTargets();
434  } else {
435  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
436 
437  switch ($a_filter["acl_type"]) {
438  case "all":
440  break;
441 
442  case "password":
444  break;
445 
446  case "registered":
448  break;
449 
450  case "course":
451  $obj_ids = $a_crs_ids;
452  break;
453 
454  case "group":
455  $obj_ids = $a_grp_ids;
456  break;
457 
458  case "user":
459  $obj_ids = array($ilUser->getId());
460  break;
461  }
462  }
463 
464  $res = array();
465 
466  $sql = "SELECT obj.obj_id,obj.title,obj.owner" .
467  ",acl.object_id acl_type, acl.tstamp acl_date" .
468  " FROM object_data obj" .
469  " JOIN usr_portfolio prtf ON (prtf.id = obj.obj_id)" .
470  " JOIN usr_portf_acl acl ON (acl.node_id = obj.obj_id)" .
471  " WHERE " . $ilDB->in("acl.object_id", $obj_ids, "", "integer") .
472  " AND obj.owner <> " . $ilDB->quote($ilUser->getId(), "integer") .
473  " AND obj.type = " . $ilDB->quote("prtf", "text") .
474  " AND prtf.is_online = " . $ilDB->quote(1, "integer");
475 
476  if ($a_filter["title"] && strlen($a_filter["title"]) >= 3) {
477  $sql .= " AND " . $ilDB->like("obj.title", "text", "%" . $a_filter["title"] . "%");
478  }
479  if ($a_filter["user"] && strlen($a_filter["user"]) >= 3) {
480  $usr_ids = array();
481  $set = $ilDB->query("SELECT usr_id FROM usr_data" .
482  " WHERE (" . $ilDB->like("login", "text", "%" . $a_filter["user"] . "%") . " " .
483  "OR " . $ilDB->like("firstname", "text", "%" . $a_filter["user"] . "%") . " " .
484  "OR " . $ilDB->like("lastname", "text", "%" . $a_filter["user"] . "%") . " " .
485  "OR " . $ilDB->like("email", "text", "%" . $a_filter["user"] . "%") . ")");
486  while ($row = $ilDB->fetchAssoc($set)) {
487  $usr_ids[] = $row["usr_id"];
488  }
489  if (!sizeof($usr_ids)) {
490  return;
491  }
492  $sql .= " AND " . $ilDB->in("obj.owner", $usr_ids, "", "integer");
493  }
494 
495  if ($a_filter["acl_date"]) {
496  $dt = $a_filter["acl_date"]->get(IL_CAL_DATE);
497  $dt = new ilDateTime($dt . " 00:00:00", IL_CAL_DATETIME);
498  $sql .= " AND acl.tstamp > " . $ilDB->quote($dt->get(IL_CAL_UNIX), "integer");
499  }
500 
501  if ($a_filter["crsgrp"]) {
502  include_once "Services/Membership/classes/class.ilParticipants.php";
503  $part = ilParticipants::getInstanceByObjId($a_filter['crsgrp']);
504  $part = $part->getParticipants();
505  if (!sizeof($part)) {
506  return;
507  }
508  $sql .= " AND " . $ilDB->in("obj.owner", $part, "", "integer");
509  }
510 
511  // we use the oldest share date
512  $sql .= " ORDER BY acl.tstamp";
513 
514  $set = $ilDB->query($sql);
515  while ($row = $ilDB->fetchAssoc($set)) {
516  if (!isset($res[$row["obj_id"]])) {
517  $row["acl_type"] = array($row["acl_type"]);
518  $res[$row["obj_id"]] = $row;
519  } else {
520  $res[$row["obj_id"]]["acl_type"][] = $row["acl_type"];
521  }
522  }
523 
524  return $res;
525  }
const IL_CAL_DATETIME
const IL_CAL_UNIX
foreach($_POST as $key=> $value) $res
Date and time handling
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
const IL_CAL_DATE
global $ilDB
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
+ Here is the call graph for this function:

◆ getObjectsIShare()

ilPortfolioAccessHandler::getObjectsIShare (   $a_online_only = true)

Definition at line 313 of file class.ilPortfolioAccessHandler.php.

References $db, $ilDB, $ilUser, $res, $row, $user, and array.

314  {
315  $ilDB = $this->db;
317 
318  $res = array();
319 
320  $sql = "SELECT obj.obj_id" .
321  " FROM object_data obj" .
322  " JOIN usr_portfolio prtf ON (prtf.id = obj.obj_id)" .
323  " JOIN usr_portf_acl acl ON (acl.node_id = obj.obj_id)" .
324  " WHERE obj.owner = " . $ilDB->quote($ilUser->getId(), "integer");
325 
326  if ($a_online_only) {
327  $sql .= " AND prtf.is_online = " . $ilDB->quote(1, "integer");
328  }
329 
330  $set = $ilDB->query($sql);
331  while ($row = $ilDB->fetchAssoc($set)) {
332  $res[] = $row["obj_id"];
333  }
334 
335  return $res;
336  }
foreach($_POST as $key=> $value) $res
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB

◆ getPermissions()

ilPortfolioAccessHandler::getPermissions (   $a_node_id)

Get all permissions to node.

Parameters
int$a_node_id
Returns
array

Definition at line 257 of file class.ilPortfolioAccessHandler.php.

258  {
259  return self::_getPermissions($a_node_id);
260  }

◆ getPossibleSharedTargets()

static ilPortfolioAccessHandler::getPossibleSharedTargets ( )
static

Definition at line 338 of file class.ilPortfolioAccessHandler.php.

References $DIC, $ilUser, ilParticipants\_getMembershipByType(), ilWorkspaceAccessGUI\PERMISSION_ALL, ilWorkspaceAccessGUI\PERMISSION_ALL_PASSWORD, and ilWorkspaceAccessGUI\PERMISSION_REGISTERED.

Referenced by findSharedObjects(), getShardObjectsDataForUserIds(), getSharedObjects(), and getSharedOwners().

339  {
340  global $DIC;
341 
342  $ilUser = $DIC->user();
343 
344  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
345  include_once "Services/Membership/classes/class.ilParticipants.php";
346  $grp_ids = ilParticipants::_getMembershipByType($ilUser->getId(), "grp");
347  $crs_ids = ilParticipants::_getMembershipByType($ilUser->getId(), "crs");
348 
349  $obj_ids = array_merge($grp_ids, $crs_ids);
350  $obj_ids[] = $ilUser->getId();
354 
355  return $obj_ids;
356  }
global $DIC
Definition: saml.php:7
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShardObjectsDataForUserIds()

ilPortfolioAccessHandler::getShardObjectsDataForUserIds ( array  $a_owner_ids)

Definition at line 406 of file class.ilPortfolioAccessHandler.php.

References $db, $ilDB, $res, $row, array, and getPossibleSharedTargets().

407  {
408  $ilDB = $this->db;
409 
410  $obj_ids = $this->getPossibleSharedTargets();
411 
412  $res = array();
413 
414  $set = $ilDB->query("SELECT obj.obj_id, obj.owner, obj.title" .
415  " FROM object_data obj" .
416  " JOIN usr_portfolio prtf ON (prtf.id = obj.obj_id)" .
417  " JOIN usr_portf_acl acl ON (acl.node_id = obj.obj_id)" .
418  " WHERE " . $ilDB->in("acl.object_id", $obj_ids, "", "integer") .
419  " AND " . $ilDB->in("obj.owner", $a_owner_ids, "", "integer") .
420  " AND prtf.is_online = " . $ilDB->quote(1, "integer"));
421  while ($row = $ilDB->fetchAssoc($set)) {
422  $res[$row["owner"]][$row["obj_id"]] = $row["title"];
423  }
424 
425  return $res;
426  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getSharedNodePassword()

static ilPortfolioAccessHandler::getSharedNodePassword (   $a_node_id)
static

Definition at line 527 of file class.ilPortfolioAccessHandler.php.

References $DIC, $ilDB, $res, and ilWorkspaceAccessGUI\PERMISSION_ALL_PASSWORD.

Referenced by ilSharedResourceGUI\checkPassword().

528  {
529  global $DIC;
530 
531  $ilDB = $DIC->database();
532 
533  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
534 
535  $set = $ilDB->query("SELECT extended_data FROM usr_portf_acl" .
536  " WHERE node_id = " . $ilDB->quote($a_node_id, "integer") .
537  " AND object_id = " . $ilDB->quote(ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD, "integer"));
538  $res = $ilDB->fetchAssoc($set);
539  if ($res) {
540  return $res["extended_data"];
541  }
542  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB
+ Here is the caller graph for this function:

◆ getSharedObjects()

ilPortfolioAccessHandler::getSharedObjects (   $a_owner_id)

Definition at line 385 of file class.ilPortfolioAccessHandler.php.

References $db, $ilDB, $res, $row, array, and getPossibleSharedTargets().

386  {
387  $ilDB = $this->db;
388 
389  $obj_ids = $this->getPossibleSharedTargets();
390 
391  $res = array();
392  $set = $ilDB->query("SELECT obj.obj_id, obj.owner" .
393  " FROM object_data obj" .
394  " JOIN usr_portfolio prtf ON (prtf.id = obj.obj_id)" .
395  " JOIN usr_portf_acl acl ON (acl.node_id = obj.obj_id)" .
396  " WHERE " . $ilDB->in("acl.object_id", $obj_ids, "", "integer") .
397  " AND obj.owner = " . $ilDB->quote($a_owner_id, "integer") .
398  " AND prtf.is_online = " . $ilDB->quote(1, "integer"));
399  while ($row = $ilDB->fetchAssoc($set)) {
400  $res[$row["obj_id"]] = $row["obj_id"];
401  }
402 
403  return $res;
404  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getSharedOwners()

ilPortfolioAccessHandler::getSharedOwners ( )

Definition at line 358 of file class.ilPortfolioAccessHandler.php.

References $db, $ilDB, $ilUser, $row, $user, array, and getPossibleSharedTargets().

359  {
361  $ilDB = $this->db;
362 
363  $obj_ids = $this->getPossibleSharedTargets();
364 
365  $user_ids = array();
366  $set = $ilDB->query("SELECT DISTINCT(obj.owner), u.lastname, u.firstname, u.title" .
367  " FROM object_data obj" .
368  " JOIN usr_portfolio prtf ON (prtf.id = obj.obj_id)" .
369  " JOIN usr_portf_acl acl ON (acl.node_id = obj.obj_id)" .
370  " JOIN usr_data u on (u.usr_id = obj.owner)" .
371  " WHERE " . $ilDB->in("acl.object_id", $obj_ids, "", "integer") .
372  " AND obj.owner <> " . $ilDB->quote($ilUser->getId(), "integer") .
373  " AND prtf.is_online = " . $ilDB->quote(1, "integer") .
374  " ORDER BY u.lastname, u.firstname, u.title");
375  while ($row = $ilDB->fetchAssoc($set)) {
376  $user_ids[$row["owner"]] = $row["lastname"] . ", " . $row["firstname"];
377  if ($row["title"]) {
378  $user_ids[$row["owner"]] .= ", " . $row["title"];
379  }
380  }
381 
382  return $user_ids;
383  }
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getSharedSessionPassword()

static ilPortfolioAccessHandler::getSharedSessionPassword (   $a_node_id)
static

Definition at line 549 of file class.ilPortfolioAccessHandler.php.

References $_SESSION.

550  {
551  return $_SESSION["ilshpw_" . $a_node_id];
552  }
$_SESSION["AccountId"]

◆ hasGlobalPasswordPermission()

ilPortfolioAccessHandler::hasGlobalPasswordPermission (   $a_node_id)

Definition at line 303 of file class.ilPortfolioAccessHandler.php.

References $db, $ilDB, and ilWorkspaceAccessGUI\PERMISSION_ALL_PASSWORD.

304  {
305  $ilDB = $this->db;
306 
307  $set = $ilDB->query("SELECT object_id FROM usr_portf_acl" .
308  " WHERE node_id = " . $ilDB->quote($a_node_id, "integer") .
309  " AND object_id = " . $ilDB->quote(ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD, "integer"));
310  return (bool) $ilDB->numRows($set);
311  }
global $ilDB

◆ hasGlobalPermission()

ilPortfolioAccessHandler::hasGlobalPermission (   $a_node_id)

Definition at line 293 of file class.ilPortfolioAccessHandler.php.

References $db, $ilDB, and ilWorkspaceAccessGUI\PERMISSION_ALL.

Referenced by syncProfile().

294  {
295  $ilDB = $this->db;
296 
297  $set = $ilDB->query("SELECT object_id FROM usr_portf_acl" .
298  " WHERE node_id = " . $ilDB->quote($a_node_id, "integer") .
299  " AND object_id = " . $ilDB->quote(ilWorkspaceAccessGUI::PERMISSION_ALL, "integer"));
300  return (bool) $ilDB->numRows($set);
301  }
global $ilDB
+ Here is the caller graph for this function:

◆ hasRegisteredPermission()

ilPortfolioAccessHandler::hasRegisteredPermission (   $a_node_id)

Definition at line 283 of file class.ilPortfolioAccessHandler.php.

References $db, $ilDB, and ilWorkspaceAccessGUI\PERMISSION_REGISTERED.

Referenced by syncProfile().

284  {
285  $ilDB = $this->db;
286 
287  $set = $ilDB->query("SELECT object_id FROM usr_portf_acl" .
288  " WHERE node_id = " . $ilDB->quote($a_node_id, "integer") .
289  " AND object_id = " . $ilDB->quote(ilWorkspaceAccessGUI::PERMISSION_REGISTERED, "integer"));
290  return (bool) $ilDB->numRows($set);
291  }
global $ilDB
+ Here is the caller graph for this function:

◆ keepSharedSessionPassword()

static ilPortfolioAccessHandler::keepSharedSessionPassword (   $a_node_id,
  $a_password 
)
static

Definition at line 544 of file class.ilPortfolioAccessHandler.php.

References $_SESSION.

Referenced by ilSharedResourceGUI\checkPassword().

545  {
546  $_SESSION["ilshpw_" . $a_node_id] = $a_password;
547  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ removePermission()

ilPortfolioAccessHandler::removePermission (   $a_node_id,
  $a_object_id = null 
)

Remove permission[s] (for object) to node.

Parameters
int$a_node_id
int$a_object_id

Definition at line 234 of file class.ilPortfolioAccessHandler.php.

References $db, $ilDB, $query, and syncProfile().

235  {
236  $ilDB = $this->db;
237 
238  $query = "DELETE FROM usr_portf_acl" .
239  " WHERE node_id = " . $ilDB->quote($a_node_id, "integer");
240 
241  if ($a_object_id) {
242  $query .= " AND object_id = " . $ilDB->quote($a_object_id, "integer");
243  }
244 
245  $ilDB->manipulate($query);
246 
247  // portfolio as profile
248  $this->syncProfile($a_node_id);
249  }
$query
global $ilDB
+ Here is the call graph for this function:

◆ setPermissions()

ilPortfolioAccessHandler::setPermissions (   $a_parent_node_id,
  $a_node_id 
)

Set permissions after creating node/object.

Parameters
int$a_parent_node_id
int$a_node_id

Definition at line 196 of file class.ilPortfolioAccessHandler.php.

197  {
198  // nothing to do as owner has irrefutable rights to any portfolio object
199  }

◆ syncProfile()

ilPortfolioAccessHandler::syncProfile (   $a_node_id)
protected

Definition at line 554 of file class.ilPortfolioAccessHandler.php.

References $ilUser, $user, ilObjPortfolio\getDefaultPortfolio(), hasGlobalPermission(), hasRegisteredPermission(), and ilObjPortfolio\setUserDefault().

Referenced by addPermission(), and removePermission().

555  {
557 
558  // #12845
559  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
560  if (ilObjPortfolio::getDefaultPortfolio($ilUser->getId()) == $a_node_id) {
561  $has_registered = $this->hasRegisteredPermission($a_node_id);
562  $has_global = $this->hasGlobalPermission($a_node_id);
563 
564  // not published anymore - remove portfolio as profile
565  if (!$has_registered && !$has_global) {
566  $ilUser->setPref("public_profile", "n");
567  $ilUser->writePrefs();
569  }
570  // adapt profile setting
571  else {
572  $new_pref = "y";
573  if ($has_global) {
574  $new_pref = "g";
575  }
576  if ($ilUser->getPref("public_profile") != $new_pref) {
577  $ilUser->setPref("public_profile", $new_pref);
578  $ilUser->writePrefs();
579  }
580  }
581  }
582  }
static setUserDefault($a_user_id, $a_portfolio_id=null)
Set the user default portfolio.
$ilUser
Definition: imgupload.php:18
static getDefaultPortfolio($a_user_id)
Get default portfolio of user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilPortfolioAccessHandler::$access
protected

Definition at line 49 of file class.ilPortfolioAccessHandler.php.

Referenced by canBeDelivered().

◆ $db

◆ $lng

ilPortfolioAccessHandler::$lng
protected

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

Referenced by __construct().

◆ $rbacreview

ilPortfolioAccessHandler::$rbacreview
protected

Definition at line 34 of file class.ilPortfolioAccessHandler.php.

Referenced by checkAccessOfUser().

◆ $settings

ilPortfolioAccessHandler::$settings
protected

Definition at line 39 of file class.ilPortfolioAccessHandler.php.

Referenced by checkAccessOfUser().

◆ $user


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