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";
47 $this->
user = $DIC->user();
48 $this->lng = $DIC->language();
49 $this->rbacreview = $DIC->rbac()->review();
51 $this->db = $DIC->database();
53 $lng = $DIC->language();
55 $lng->loadLanguageModule(
"wsp");
58 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
61 $this->tree = $a_tree;
110 if (!
$ilSetting->get(
"enable_global_profiles") &&
$ilUser->getId() == ANONYMOUS_USER_ID) {
115 if ($a_permission ==
"write") {
122 if ($a_tree->lookupOwner($a_node_id) == $a_user_id) {
127 if ($a_permission ==
"read" || $a_permission ==
"visible") {
132 foreach ($objects as $obj_id) {
139 if (self::getSharedNodePassword($a_node_id) == self::getSharedSessionPassword($a_node_id) ||
140 $a_permission ==
"visible") {
146 if (
$ilUser->getId() != ANONYMOUS_USER_ID) {
169 if (
$rbacreview->isAssigned($a_user_id, $obj_id)) {
176 if ($a_user_id == $obj_id) {
209 public function addPermission($a_node_id, $a_object_id, $a_extended_data = null)
215 if ($this->tree->getTreeId() ==
$ilUser->getId() &&
216 $a_object_id ==
$ilUser->getId()) {
220 $ilDB->manipulate(
"INSERT INTO acl_ws (node_id, object_id, extended_data, tstamp)" .
221 " VALUES (" .
$ilDB->quote($a_node_id,
"integer") .
", " .
222 $ilDB->quote($a_object_id,
"integer") .
"," .
223 $ilDB->quote($a_extended_data,
"text") .
"," .
224 $ilDB->quote(time(),
"integer") .
")");
238 $query =
"DELETE FROM acl_ws" .
239 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer");
242 $query .=
" AND object_id = " .
$ilDB->quote($a_object_id,
"integer");
256 return self::_getPermissions($a_node_id);
269 $ilDB = $DIC->database();
272 $publish_enabled =
$ilSetting->get(
"enable_global_profiles");
276 $set =
$ilDB->query(
"SELECT object_id FROM acl_ws" .
277 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer"));
279 while ($row =
$ilDB->fetchAssoc($set)) {
280 if ($publish_enabled || !in_array($row[
"object_id"], $publish_perm)) {
281 $res[] = $row[
"object_id"];
291 $set =
$ilDB->query(
"SELECT object_id FROM acl_ws" .
292 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
294 return (
bool)
$ilDB->numRows($set);
302 if (!
$ilSetting->get(
"enable_global_profiles")) {
306 $set =
$ilDB->query(
"SELECT object_id FROM acl_ws" .
307 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
309 return (
bool)
$ilDB->numRows($set);
317 if (!
$ilSetting->get(
"enable_global_profiles")) {
321 $set =
$ilDB->query(
"SELECT object_id FROM acl_ws" .
322 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
324 return (
bool)
$ilDB->numRows($set);
334 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
335 include_once
"Services/Membership/classes/class.ilParticipants.php";
339 $obj_ids = array_merge($grp_ids, $crs_ids);
343 if (
$ilSetting->get(
"enable_global_profiles")) {
359 $set =
$ilDB->query(
"SELECT DISTINCT(obj.owner), u.lastname, u.firstname, u.title" .
360 " FROM object_data obj" .
361 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
362 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
363 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
364 " JOIN usr_data u on (u.usr_id = obj.owner)" .
365 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
366 " AND obj.owner <> " .
$ilDB->quote(
$ilUser->getId(),
"integer") .
367 " ORDER BY u.lastname, u.firstname, u.title");
368 while ($row =
$ilDB->fetchAssoc($set)) {
369 $user_ids[$row[
"owner"]] = $row[
"lastname"] .
", " . $row[
"firstname"];
371 $user_ids[$row[
"owner"]] .=
", " . $row[
"title"];
385 $set =
$ilDB->query(
"SELECT ref.wsp_id,obj.obj_id" .
386 " FROM object_data obj" .
387 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
388 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
389 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
390 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
391 " AND obj.owner = " .
$ilDB->quote($a_owner_id,
"integer"));
392 while ($row =
$ilDB->fetchAssoc($set)) {
393 $res[$row[
"wsp_id"]] = $row[
"obj_id"];
399 public function findSharedObjects(array $a_filter = null, array $a_crs_ids = null, array $a_grp_ids = null)
404 if (!$a_filter[
"acl_type"]) {
407 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
409 switch ($a_filter[
"acl_type"]) {
423 $obj_ids = $a_crs_ids;
427 $obj_ids = $a_grp_ids;
431 $obj_ids = array(
$ilUser->getId());
438 $sql =
"SELECT ref.wsp_id,obj.obj_id,obj.type,obj.title,obj.owner," .
439 "acl.object_id acl_type, acl.tstamp acl_date" .
440 " FROM object_data obj" .
441 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
442 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
443 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
444 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
445 " AND obj.owner <> " .
$ilDB->quote(
$ilUser->getId(),
"integer");
447 if ($a_filter[
"obj_type"]) {
448 $sql .=
" AND obj.type = " .
$ilDB->quote($a_filter[
"obj_type"],
"text");
450 if ($a_filter[
"title"] && strlen($a_filter[
"title"]) >= 3) {
451 $sql .=
" AND " .
$ilDB->like(
"obj.title",
"text",
"%" . $a_filter[
"title"] .
"%");
453 if ($a_filter[
"user"] && strlen($a_filter[
"user"]) >= 3) {
455 $set =
$ilDB->query(
"SELECT usr_id FROM usr_data" .
456 " WHERE (" .
$ilDB->like(
"login",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
457 "OR " .
$ilDB->like(
"firstname",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
458 "OR " .
$ilDB->like(
"lastname",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
459 "OR " .
$ilDB->like(
"email",
"text",
"%" . $a_filter[
"user"] .
"%") .
")");
460 while ($row =
$ilDB->fetchAssoc($set)) {
461 $usr_ids[] = $row[
"usr_id"];
463 if (!
sizeof($usr_ids)) {
466 $sql .=
" AND " .
$ilDB->in(
"obj.owner", $usr_ids,
"",
"integer");
469 if ($a_filter[
"acl_date"]) {
472 $sql .=
" AND acl.tstamp > " .
$ilDB->quote($dt->get(
IL_CAL_UNIX),
"integer");
475 if ($a_filter[
"crsgrp"]) {
476 include_once
"Services/Membership/classes/class.ilParticipants.php";
478 $part = $part->getParticipants();
479 if (!
sizeof($part)) {
482 $sql .=
" AND " .
$ilDB->in(
"obj.owner", $part,
"",
"integer");
486 $sql .=
" ORDER BY acl.tstamp";
488 $set =
$ilDB->query($sql);
489 while ($row =
$ilDB->fetchAssoc($set)) {
490 if (!isset(
$res[$row[
"wsp_id"]])) {
491 $row[
"acl_type"] = array($row[
"acl_type"]);
492 $res[$row[
"wsp_id"]] = $row;
494 $res[$row[
"wsp_id"]][
"acl_type"][] = $row[
"acl_type"];
505 $ilDB = $DIC->database();
507 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
509 $set =
$ilDB->query(
"SELECT * FROM acl_ws" .
510 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
514 return $res[
"extended_data"];
520 $_SESSION[
"ilshpw_" . $a_node_id] = $a_password;
525 return $_SESSION[
"ilshpw_" . $a_node_id];
528 public static function getGotoLink($a_node_id, $a_obj_id, $a_additional = null)
530 include_once(
'./Services/Link/classes/class.ilLink.php');
540 $set =
$ilDB->query(
"SELECT ref.wsp_id,obj.obj_id" .
541 " FROM object_data obj" .
542 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
543 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
544 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
545 " WHERE obj.owner = " .
$ilDB->quote(
$ilUser->getId(),
"integer"));
546 while ($row =
$ilDB->fetchAssoc($set)) {
547 $res[$row[
"wsp_id"]] = $row[
"obj_id"];
557 $ilDB = $DIC->database();
559 $set =
$ilDB->query(
"SELECT obj.obj_id, obj.type, obj.title" .
560 " FROM object_reference_ws ref" .
561 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
562 " JOIN object_data obj ON (ref.obj_id = obj.obj_id)" .
563 " WHERE ref.wsp_id = " .
$ilDB->quote($a_node_id,
"integer"));
564 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.
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.
getPermissions($a_node_id)
Get all permissions to node.
findSharedObjects(array $a_filter=null, array $a_crs_ids=null, array $a_grp_ids=null)
foreach($_POST as $key=> $value) $res
static getGotoLink($a_node_id, $a_obj_id, $a_additional=null)
getSharedObjects($a_owner_id)
static getObjectDataFromNode($a_node_id)
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
static _getPermissions($a_node_id)
Get all permissions to node.
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