5 include_once
"Modules/Group/classes/class.ilGroupParticipants.php";
6 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
7 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
25 $lng->loadLanguageModule(
"wsp");
29 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
32 $this->tree = $a_tree;
54 public function checkAccess($a_permission, $a_cmd, $a_node_id, $a_type =
"")
58 return $this->
checkAccessOfUser($this->tree, $ilUser->getId(),$a_permission, $a_cmd, $a_node_id, $a_type);
79 if(!$ilSetting->get(
"enable_global_profiles") && $ilUser->getId() == ANONYMOUS_USER_ID)
85 if($a_permission ==
"write")
94 if($a_tree->lookupOwner($a_node_id) == $a_user_id)
100 if($a_permission ==
"read" || $a_permission ==
"visible")
107 foreach($objects as $obj_id)
116 if(self::getSharedNodePassword($a_node_id) == self::getSharedSessionPassword($a_node_id) ||
117 $a_permission ==
"visible")
124 if($ilUser->getId() != ANONYMOUS_USER_ID)
151 if($rbacreview->isAssigned($a_user_id, $obj_id))
159 if($a_user_id == $obj_id)
193 public function addPermission($a_node_id, $a_object_id, $a_extended_data = null)
198 if($this->tree->getTreeId() == $ilUser->getId() &&
199 $a_object_id == $ilUser->getId())
204 $ilDB->manipulate(
"INSERT INTO acl_ws (node_id, object_id, extended_data, tstamp)".
205 " VALUES (".$ilDB->quote($a_node_id,
"integer").
", ".
206 $ilDB->quote($a_object_id,
"integer").
",".
207 $ilDB->quote($a_extended_data,
"text").
",".
208 $ilDB->quote(time(),
"integer").
")");
222 $query =
"DELETE FROM acl_ws".
223 " WHERE node_id = ".$ilDB->quote($a_node_id,
"integer");
227 $query .=
" AND object_id = ".$ilDB->quote($a_object_id,
"integer");
230 return $ilDB->manipulate(
$query);
243 $publish_enabled = $ilSetting->get(
"enable_global_profiles");
247 $set = $ilDB->query(
"SELECT object_id FROM acl_ws".
248 " WHERE node_id = ".$ilDB->quote($a_node_id,
"integer"));
250 while(
$row = $ilDB->fetchAssoc($set))
252 if($publish_enabled || !in_array(
$row[
"object_id"], $publish_perm))
264 $set = $ilDB->query(
"SELECT object_id FROM acl_ws".
265 " WHERE node_id = ".$ilDB->quote($a_node_id,
"integer").
267 return (
bool)$ilDB->numRows($set);
274 if(!$ilSetting->get(
"enable_global_profiles"))
279 $set = $ilDB->query(
"SELECT object_id FROM acl_ws".
280 " WHERE node_id = ".$ilDB->quote($a_node_id,
"integer").
282 return (
bool)$ilDB->numRows($set);
289 if(!$ilSetting->get(
"enable_global_profiles"))
294 $set = $ilDB->query(
"SELECT object_id FROM acl_ws".
295 " WHERE node_id = ".$ilDB->quote($a_node_id,
"integer").
297 return (
bool)$ilDB->numRows($set);
304 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
305 include_once
"Services/Membership/classes/class.ilParticipants.php";
309 $obj_ids = array_merge($grp_ids, $crs_ids);
310 $obj_ids[] = $ilUser->getId();
313 if($ilSetting->get(
"enable_global_profiles"))
329 $set = $ilDB->query(
"SELECT DISTINCT(obj.owner), u.lastname, u.firstname, u.title".
330 " FROM object_data obj".
331 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)".
332 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)".
333 " JOIN acl_ws acl ON (acl.node_id = tree.child)".
334 " JOIN usr_data u on (u.usr_id = obj.owner)".
335 " WHERE ".$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer").
336 " AND obj.owner <> ".$ilDB->quote($ilUser->getId(),
"integer").
337 " ORDER BY u.lastname, u.firstname, u.title");
338 while (
$row = $ilDB->fetchAssoc($set))
340 $user_ids[
$row[
"owner"]] = $row[
"lastname"].
", ".$row[
"firstname"];
343 $user_ids[$row[
"owner"]] .=
", ".$row[
"title"];
357 $set = $ilDB->query(
"SELECT ref.wsp_id,obj.obj_id".
358 " FROM object_data obj".
359 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)".
360 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)".
361 " JOIN acl_ws acl ON (acl.node_id = tree.child)".
362 " WHERE ".$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer").
363 " AND obj.owner = ".$ilDB->quote($a_owner_id,
"integer"));
364 while (
$row = $ilDB->fetchAssoc($set))
366 $res[
$row[
"wsp_id"]] = $row[
"obj_id"];
372 public function findSharedObjects(array $a_filter = null, array $a_crs_ids = null, array $a_grp_ids = null)
376 if(!$a_filter[
"acl_type"])
382 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
384 switch($a_filter[
"acl_type"])
399 $obj_ids = $a_crs_ids;
403 $obj_ids = $a_grp_ids;
407 $obj_ids = array($ilUser->getId());
414 $sql =
"SELECT ref.wsp_id,obj.obj_id,obj.type,obj.title,obj.owner,".
415 "acl.object_id acl_type, acl.tstamp acl_date".
416 " FROM object_data obj".
417 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)".
418 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)".
419 " JOIN acl_ws acl ON (acl.node_id = tree.child)".
420 " WHERE ".$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer").
421 " AND obj.owner <> ".$ilDB->quote($ilUser->getId(),
"integer");
423 if($a_filter[
"obj_type"])
425 $sql .=
" AND obj.type = ".$ilDB->quote($a_filter[
"obj_type"],
"text");
427 if($a_filter[
"title"] && strlen($a_filter[
"title"]) >= 3)
429 $sql .=
" AND ".$ilDB->like(
"obj.title",
"text",
"%".$a_filter[
"title"].
"%");
431 if($a_filter[
"user"] && strlen($a_filter[
"user"]) >= 3)
434 $set = $ilDB->query(
"SELECT usr_id FROM usr_data".
435 " WHERE (".$ilDB->like(
"login",
"text",
"%".$a_filter[
"user"].
"%").
" ".
436 "OR ".$ilDB->like(
"firstname",
"text",
"%".$a_filter[
"user"].
"%").
" ".
437 "OR ".$ilDB->like(
"lastname",
"text",
"%".$a_filter[
"user"].
"%").
" ".
438 "OR ".$ilDB->like(
"email",
"text",
"%".$a_filter[
"user"].
"%").
")");
439 while(
$row = $ilDB->fetchAssoc($set))
441 $usr_ids[] =
$row[
"usr_id"];
443 if(!
sizeof($usr_ids))
447 $sql .=
" AND ".$ilDB->in(
"obj.owner", $usr_ids,
"",
"integer");
450 if($a_filter[
"acl_date"])
454 $sql .=
" AND acl.tstamp > ".$ilDB->quote($dt->get(
IL_CAL_UNIX),
"integer");
457 if($a_filter[
"crsgrp"])
459 include_once
"Services/Membership/classes/class.ilParticipants.php";
461 $part = $part->getParticipants();
466 $sql .=
" AND ".$ilDB->in(
"obj.owner", $part,
"",
"integer");
470 $sql .=
" ORDER BY acl.tstamp";
472 $set = $ilDB->query($sql);
473 while (
$row = $ilDB->fetchAssoc($set))
477 $row[
"acl_type"] = array($row[
"acl_type"]);
482 $res[$row[
"wsp_id"]][
"acl_type"][] = $row[
"acl_type"];
493 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
495 $set = $ilDB->query(
"SELECT * FROM acl_ws".
496 " WHERE node_id = ".$ilDB->quote($a_node_id,
"integer").
498 $res = $ilDB->fetchAssoc($set);
501 return $res[
"extended_data"];
507 $_SESSION[
"ilshpw_".$a_node_id] = $a_password;
515 public static function getGotoLink($a_node_id, $a_obj_id, $a_additional = null)
517 include_once(
'./Services/Link/classes/class.ilLink.php');
526 $set = $ilDB->query(
"SELECT ref.wsp_id,obj.obj_id".
527 " FROM object_data obj".
528 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)".
529 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)".
530 " JOIN acl_ws acl ON (acl.node_id = tree.child)".
531 " WHERE obj.owner = ".$ilDB->quote($ilUser->getId(),
"integer"));
532 while (
$row = $ilDB->fetchAssoc($set))
534 $res[
$row[
"wsp_id"]] = $row[
"obj_id"];
544 $set = $ilDB->query(
"SELECT obj.obj_id, obj.type, obj.title".
545 " FROM object_reference_ws ref".
546 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)".
547 " JOIN object_data obj ON (ref.obj_id = obj.obj_id)".
548 " WHERE ref.wsp_id = ".$ilDB->quote($a_node_id,
"integer"));
549 return $ilDB->fetchAssoc($set);
hasGlobalPermission($a_node_id)
getTree()
Get workspace tree.
hasRegisteredPermission($a_node_id)
static getPossibleSharedTargets()
__construct(ilTree $a_tree=null)
static getSharedSessionPassword($a_node_id)
const PERMISSION_ALL_PASSWORD
static _getStaticLink($a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
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.
Access handler for personal workspace.
static getPermissions($a_node_id)
Get all permissions to node.
removePermission($a_node_id, $a_object_id=null)
Remove permission[s] (for object) to node.
const PERMISSION_REGISTERED
static getSharedNodePassword($a_node_id)
Tree handler for personal workspace.
findSharedObjects(array $a_filter=null, array $a_crs_ids=null, array $a_grp_ids=null)
static getGotoLink($a_node_id, $a_obj_id, $a_additional=null)
getSharedObjects($a_owner_id)
static getObjectDataFromNode($a_node_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
setPermissions($a_parent_node_id, $a_node_id)
Set permissions after creating node/object.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
static keepSharedSessionPassword($a_node_id, $a_password)
checkAccess($a_permission, $a_cmd, $a_node_id, $a_type="")
check access for an object
checkAccessOfUser(ilTree $a_tree, $a_user_id, $a_permission, $a_cmd, $a_node_id, $a_type="")
check access for an object
addPermission($a_node_id, $a_object_id, $a_extended_data=null)
Add permission to node for object.
hasGlobalPasswordPermission($a_node_id)
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
readRootId()
read root id from database