46 $this->lng = $DIC->language();
47 $this->
user = $DIC->user();
48 $this->rbacreview = $DIC->rbac()->review();
50 $this->db = $DIC->database();
51 $this->access = $DIC->access();
52 $lng = $DIC->language();
53 $lng->loadLanguageModule(
"wsp");
65 public function checkAccess($a_permission, $a_cmd, $a_node_id, $a_type =
"")
82 public function checkAccessOfUser($a_user_id, $a_permission, $a_cmd, $a_node_id, $a_type =
"")
106 if ($pf->getOwner() == $a_user_id) {
111 if (!$pf->isOnline()) {
116 if ($a_permission ==
"read" || $a_permission ==
"visible") {
118 $objects = self::_getPermissions($a_node_id);
121 foreach ($objects as $obj_id) {
128 if (self::getSharedNodePassword($a_node_id) == self::getSharedSessionPassword($a_node_id) ||
129 $a_permission ==
"visible") {
158 if (
$rbacreview->isAssigned($a_user_id, $obj_id)) {
165 if ($a_user_id == $obj_id) {
197 public function addPermission($a_node_id, $a_object_id, $a_extended_data = null)
203 if ($a_object_id ==
$ilUser->getId()) {
207 $ilDB->manipulate(
"INSERT INTO usr_portf_acl (node_id, object_id, extended_data, tstamp)" .
208 " VALUES (" .
$ilDB->quote($a_node_id,
"integer") .
", " .
209 $ilDB->quote($a_object_id,
"integer") .
"," .
210 $ilDB->quote($a_extended_data,
"text") .
"," .
211 $ilDB->quote(time(),
"integer") .
")");
227 $query =
"DELETE FROM usr_portf_acl" .
228 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer");
231 $query .=
" AND object_id = " .
$ilDB->quote($a_object_id,
"integer");
248 return self::_getPermissions($a_node_id);
261 $ilDB = $DIC->database();
263 $set =
$ilDB->query(
"SELECT object_id FROM usr_portf_acl" .
264 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer"));
266 while ($row =
$ilDB->fetchAssoc($set)) {
267 $res[] = $row[
"object_id"];
276 $set =
$ilDB->query(
"SELECT object_id FROM usr_portf_acl" .
277 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
279 return (
bool)
$ilDB->numRows($set);
286 $set =
$ilDB->query(
"SELECT object_id FROM usr_portf_acl" .
287 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
289 return (
bool)
$ilDB->numRows($set);
296 $set =
$ilDB->query(
"SELECT object_id FROM usr_portf_acl" .
297 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
299 return (
bool)
$ilDB->numRows($set);
309 $sql =
"SELECT obj.obj_id" .
310 " FROM object_data obj" .
311 " JOIN usr_portfolio prtf ON (prtf.id = obj.obj_id)" .
312 " JOIN usr_portf_acl acl ON (acl.node_id = obj.obj_id)" .
313 " WHERE obj.owner = " .
$ilDB->quote(
$ilUser->getId(),
"integer");
315 if ($a_online_only) {
316 $sql .=
" AND prtf.is_online = " .
$ilDB->quote(1,
"integer");
319 $set =
$ilDB->query($sql);
320 while ($row =
$ilDB->fetchAssoc($set)) {
321 $res[] = $row[
"obj_id"];
336 $obj_ids = array_merge($grp_ids, $crs_ids);
353 $set =
$ilDB->query(
"SELECT DISTINCT(obj.owner), u.lastname, u.firstname, u.title" .
354 " FROM object_data obj" .
355 " JOIN usr_portfolio prtf ON (prtf.id = obj.obj_id)" .
356 " JOIN usr_portf_acl acl ON (acl.node_id = obj.obj_id)" .
357 " JOIN usr_data u on (u.usr_id = obj.owner)" .
358 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
359 " AND obj.owner <> " .
$ilDB->quote(
$ilUser->getId(),
"integer") .
360 " AND prtf.is_online = " .
$ilDB->quote(1,
"integer") .
361 " ORDER BY u.lastname, u.firstname, u.title");
362 while ($row =
$ilDB->fetchAssoc($set)) {
363 $user_ids[$row[
"owner"]] = $row[
"lastname"] .
", " . $row[
"firstname"];
365 $user_ids[$row[
"owner"]] .=
", " . $row[
"title"];
379 $set =
$ilDB->query(
"SELECT obj.obj_id, obj.owner" .
380 " FROM object_data obj" .
381 " JOIN usr_portfolio prtf ON (prtf.id = obj.obj_id)" .
382 " JOIN usr_portf_acl acl ON (acl.node_id = obj.obj_id)" .
383 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
384 " AND obj.owner = " .
$ilDB->quote($a_owner_id,
"integer") .
385 " AND prtf.is_online = " .
$ilDB->quote(1,
"integer"));
386 while ($row =
$ilDB->fetchAssoc($set)) {
387 $res[$row[
"obj_id"]] = $row[
"obj_id"];
401 $set =
$ilDB->query(
"SELECT obj.obj_id, obj.owner, obj.title" .
402 " FROM object_data obj" .
403 " JOIN usr_portfolio prtf ON (prtf.id = obj.obj_id)" .
404 " JOIN usr_portf_acl acl ON (acl.node_id = obj.obj_id)" .
405 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
406 " AND " .
$ilDB->in(
"obj.owner", $a_owner_ids,
"",
"integer") .
407 " AND prtf.is_online = " .
$ilDB->quote(1,
"integer"));
408 while ($row =
$ilDB->fetchAssoc($set)) {
409 $res[$row[
"owner"]][$row[
"obj_id"]] = $row[
"title"];
415 public function findSharedObjects(array $a_filter = null, array $a_crs_ids = null, array $a_grp_ids = null)
419 if (!$a_filter[
"acl_type"]) {
422 switch ($a_filter[
"acl_type"]) {
436 $obj_ids = $a_crs_ids;
440 $obj_ids = $a_grp_ids;
444 $obj_ids = array(
$ilUser->getId());
451 $sql =
"SELECT obj.obj_id,obj.title,obj.owner" .
452 ",acl.object_id acl_type, acl.tstamp acl_date" .
453 " FROM object_data obj" .
454 " JOIN usr_portfolio prtf ON (prtf.id = obj.obj_id)" .
455 " JOIN usr_portf_acl acl ON (acl.node_id = obj.obj_id)" .
456 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
457 " AND obj.owner <> " .
$ilDB->quote(
$ilUser->getId(),
"integer") .
458 " AND obj.type = " .
$ilDB->quote(
"prtf",
"text") .
459 " AND prtf.is_online = " .
$ilDB->quote(1,
"integer");
461 if ($a_filter[
"title"] && strlen($a_filter[
"title"]) >= 3) {
462 $sql .=
" AND " .
$ilDB->like(
"obj.title",
"text",
"%" . $a_filter[
"title"] .
"%");
464 if ($a_filter[
"user"] && strlen($a_filter[
"user"]) >= 3) {
466 $set =
$ilDB->query(
"SELECT usr_id FROM usr_data" .
467 " WHERE (" .
$ilDB->like(
"login",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
468 "OR " .
$ilDB->like(
"firstname",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
469 "OR " .
$ilDB->like(
"lastname",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
470 "OR " .
$ilDB->like(
"email",
"text",
"%" . $a_filter[
"user"] .
"%") .
")");
471 while ($row =
$ilDB->fetchAssoc($set)) {
472 $usr_ids[] = $row[
"usr_id"];
474 if (!
sizeof($usr_ids)) {
477 $sql .=
" AND " .
$ilDB->in(
"obj.owner", $usr_ids,
"",
"integer");
480 if ($a_filter[
"acl_date"]) {
483 $sql .=
" AND acl.tstamp > " .
$ilDB->quote($dt->get(
IL_CAL_UNIX),
"integer");
486 if ($a_filter[
"crsgrp"]) {
488 $part = $part->getParticipants();
489 if (!
sizeof($part)) {
492 $sql .=
" AND " .
$ilDB->in(
"obj.owner", $part,
"",
"integer");
496 $sql .=
" ORDER BY acl.tstamp";
498 $set =
$ilDB->query($sql);
499 while ($row =
$ilDB->fetchAssoc($set)) {
500 if (!isset(
$res[$row[
"obj_id"]])) {
501 $row[
"acl_type"] = array($row[
"acl_type"]);
502 $res[$row[
"obj_id"]] = $row;
504 $res[$row[
"obj_id"]][
"acl_type"][] = $row[
"acl_type"];
515 $ilDB = $DIC->database();
517 $set =
$ilDB->query(
"SELECT extended_data FROM usr_portf_acl" .
518 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
522 return $res[
"extended_data"];
528 $_SESSION[
"ilshpw_" . $a_node_id] = $a_password;
533 return $_SESSION[
"ilshpw_" . $a_node_id];
546 if (!$has_registered && !$has_global) {
547 $ilUser->setPref(
"public_profile",
"n");
557 if (
$ilUser->getPref(
"public_profile") != $new_pref) {
558 $ilUser->setPref(
"public_profile", $new_pref);
576 if (preg_match(
"/\\/prtf_([\\d]*)\\//uism", $ilWACPath->
getPath(),
$results)) {
587 foreach ($ref_ids as $ref_id) {
588 if ($ilAccess->checkAccessOfUser(
$ilUser->getId(),
"read",
"view", $ref_id,
"prtt", $obj_id)) {
603 return (
bool) $this->
settings->get(
'user_portfolios');
static getSharedNodePassword($a_node_id)
checkAccessOfUser($a_user_id, $a_permission, $a_cmd, $a_node_id, $a_type="")
check access for an object
setPermissions($a_parent_node_id, $a_node_id)
Set permissions after creating node/object.
const PERMISSION_ALL_PASSWORD
hasGlobalPermission($a_node_id)
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static getSharedSessionPassword($a_node_id)
addPermission($a_node_id, $a_object_id, $a_extended_data=null)
Add permission to node for object.
const PERMISSION_REGISTERED
static _getAllReferences($a_id)
get all reference ids of object
static _getPermissions($a_node_id)
Get all permissions to node.
canBeDelivered(ilWACPath $ilWACPath)
static keepSharedSessionPassword($a_node_id, $a_password)
foreach($_POST as $key=> $value) $res
hasGlobalPasswordPermission($a_node_id)
static setUserDefault($a_user_id, $a_portfolio_id=null)
Set the user default portfolio.
findSharedObjects(array $a_filter=null, array $a_crs_ids=null, array $a_grp_ids=null)
Class ilWACCheckingClass.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
getPermissions($a_node_id)
Get all permissions to node.
removePermission($a_node_id, $a_object_id=null)
Remove permission[s] (for object) to node.
getShardObjectsDataForUserIds(array $a_owner_ids)
editPortfolios()
Is portfolio editing (general feature) enabled.
getSharedObjects($a_owner_id)
Access handler for portfolio.
hasRegisteredPermission($a_node_id)
static getPossibleSharedTargets()
static getDefaultPortfolio($a_user_id)
Get default portfolio of user.
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
checkAccess($a_permission, $a_cmd, $a_node_id, $a_type="")
check access for an object
getObjectsIShare($a_online_only=true)