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";
50 $this->
user = $DIC->user();
51 $this->lng = $DIC->language();
52 $this->rbacreview = $DIC->rbac()->review();
54 $this->db = $DIC->database();
56 $lng = $DIC->language();
58 $lng->loadLanguageModule(
"wsp");
61 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
64 $this->tree = $a_tree;
113 if (!
$ilSetting->get(
"enable_global_profiles") &&
$ilUser->getId() == ANONYMOUS_USER_ID) {
118 if ($a_permission ==
"write") {
125 if ($a_tree->lookupOwner($a_node_id) == $a_user_id) {
130 if ($a_permission ==
"read" || $a_permission ==
"visible") {
135 foreach ($objects as $obj_id) {
142 if (self::getSharedNodePassword($a_node_id) == self::getSharedSessionPassword($a_node_id) ||
143 $a_permission ==
"visible") {
149 if (
$ilUser->getId() != ANONYMOUS_USER_ID) {
172 if (
$rbacreview->isAssigned($a_user_id, $obj_id)) {
179 if ($a_user_id == $obj_id) {
212 public function addPermission($a_node_id, $a_object_id, $a_extended_data = null)
218 if ($this->tree->getTreeId() ==
$ilUser->getId() &&
219 $a_object_id ==
$ilUser->getId()) {
223 $ilDB->manipulate(
"INSERT INTO acl_ws (node_id, object_id, extended_data, tstamp)" .
224 " VALUES (" .
$ilDB->quote($a_node_id,
"integer") .
", " .
225 $ilDB->quote($a_object_id,
"integer") .
"," .
226 $ilDB->quote($a_extended_data,
"text") .
"," .
241 $query =
"DELETE FROM acl_ws" .
242 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer");
245 $query .=
" AND object_id = " .
$ilDB->quote($a_object_id,
"integer");
259 return self::_getPermissions($a_node_id);
272 $ilDB = $DIC->database();
275 $publish_enabled =
$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"));
283 if ($publish_enabled || !in_array(
$row[
"object_id"], $publish_perm)) {
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);
305 if (!
$ilSetting->get(
"enable_global_profiles")) {
309 $set =
$ilDB->query(
"SELECT object_id FROM acl_ws" .
310 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
312 return (
bool)
$ilDB->numRows($set);
320 if (!
$ilSetting->get(
"enable_global_profiles")) {
324 $set =
$ilDB->query(
"SELECT object_id FROM acl_ws" .
325 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
327 return (
bool)
$ilDB->numRows($set);
337 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
338 include_once
"Services/Membership/classes/class.ilParticipants.php";
342 $obj_ids = array_merge($grp_ids, $crs_ids);
346 if (
$ilSetting->get(
"enable_global_profiles")) {
362 $set =
$ilDB->query(
"SELECT DISTINCT(obj.owner), u.lastname, u.firstname, u.title" .
363 " FROM object_data obj" .
364 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
365 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
366 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
367 " JOIN usr_data u on (u.usr_id = obj.owner)" .
368 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
369 " AND obj.owner <> " .
$ilDB->quote(
$ilUser->getId(),
"integer") .
370 " ORDER BY u.lastname, u.firstname, u.title");
372 $user_ids[
$row[
"owner"]] = $row[
"lastname"] .
", " . $row[
"firstname"];
374 $user_ids[$row[
"owner"]] .=
", " . $row[
"title"];
388 $set =
$ilDB->query(
"SELECT ref.wsp_id,obj.obj_id" .
389 " FROM object_data obj" .
390 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
391 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
392 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
393 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
394 " AND obj.owner = " .
$ilDB->quote($a_owner_id,
"integer"));
396 $res[
$row[
"wsp_id"]] = $row[
"obj_id"];
407 if (!$a_filter[
"acl_type"]) {
410 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
412 switch ($a_filter[
"acl_type"]) {
426 $obj_ids = $a_crs_ids;
430 $obj_ids = $a_grp_ids;
441 $sql =
"SELECT ref.wsp_id,obj.obj_id,obj.type,obj.title,obj.owner," .
442 "acl.object_id acl_type, acl.tstamp acl_date" .
443 " FROM object_data obj" .
444 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
445 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
446 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
447 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
448 " AND obj.owner <> " .
$ilDB->quote(
$ilUser->getId(),
"integer");
450 if ($a_filter[
"obj_type"]) {
451 $sql .=
" AND obj.type = " .
$ilDB->quote($a_filter[
"obj_type"],
"text");
453 if ($a_filter[
"title"] && strlen($a_filter[
"title"]) >= 3) {
454 $sql .=
" AND " .
$ilDB->like(
"obj.title",
"text",
"%" . $a_filter[
"title"] .
"%");
456 if ($a_filter[
"user"] && strlen($a_filter[
"user"]) >= 3) {
458 $set =
$ilDB->query(
"SELECT usr_id FROM usr_data" .
459 " WHERE (" .
$ilDB->like(
"login",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
460 "OR " .
$ilDB->like(
"firstname",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
461 "OR " .
$ilDB->like(
"lastname",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
462 "OR " .
$ilDB->like(
"email",
"text",
"%" . $a_filter[
"user"] .
"%") .
")");
464 $usr_ids[] =
$row[
"usr_id"];
466 if (!
sizeof($usr_ids)) {
469 $sql .=
" AND " .
$ilDB->in(
"obj.owner", $usr_ids,
"",
"integer");
472 if ($a_filter[
"acl_date"]) {
475 $sql .=
" AND acl.tstamp > " .
$ilDB->quote($dt->get(
IL_CAL_UNIX),
"integer");
478 if ($a_filter[
"crsgrp"]) {
479 include_once
"Services/Membership/classes/class.ilParticipants.php";
481 $part = $part->getParticipants();
482 if (!
sizeof($part)) {
485 $sql .=
" AND " .
$ilDB->in(
"obj.owner", $part,
"",
"integer");
489 $sql .=
" ORDER BY acl.tstamp";
491 $set =
$ilDB->query($sql);
494 $row[
"acl_type"] =
array($row[
"acl_type"]);
497 $res[$row[
"wsp_id"]][
"acl_type"][] = $row[
"acl_type"];
508 $ilDB = $DIC->database();
510 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
512 $set =
$ilDB->query(
"SELECT * FROM acl_ws" .
513 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
517 return $res[
"extended_data"];
523 $_SESSION[
"ilshpw_" . $a_node_id] = $a_password;
528 return $_SESSION[
"ilshpw_" . $a_node_id];
531 public static function getGotoLink($a_node_id, $a_obj_id, $a_additional = null)
533 include_once(
'./Services/Link/classes/class.ilLink.php');
543 $set =
$ilDB->query(
"SELECT ref.wsp_id,obj.obj_id" .
544 " FROM object_data obj" .
545 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
546 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
547 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
548 " WHERE obj.owner = " .
$ilDB->quote(
$ilUser->getId(),
"integer"));
550 $res[
$row[
"wsp_id"]] = $row[
"obj_id"];
560 $ilDB = $DIC->database();
562 $set =
$ilDB->query(
"SELECT obj.obj_id, obj.type, obj.title" .
563 " FROM object_reference_ws ref" .
564 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
565 " JOIN object_data obj ON (ref.obj_id = obj.obj_id)" .
566 " WHERE ref.wsp_id = " .
$ilDB->quote($a_node_id,
"integer"));
567 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)
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.
Create styles array
The data for the language used.
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.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
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