41 $this->
user = $DIC->user();
42 $this->
lng = $DIC->language();
43 $this->rbacreview = $DIC->rbac()->review();
45 $this->db = $DIC->database();
46 $ilUser = $DIC->user();
47 $lng = $DIC->language();
54 $this->tree = $a_tree;
74 return $this->
checkAccessOfUser($this->tree, $ilUser->getId(), $a_permission, $a_cmd, $a_node_id, $a_type);
100 if ($a_permission ==
"write") {
107 if ($a_tree->lookupOwner($a_node_id) == $a_user_id) {
112 if ($a_permission ==
"read" || $a_permission ==
"visible") {
117 foreach ($objects as $obj_id) {
124 if (self::getSharedNodePassword($a_node_id) == self::getSharedSessionPassword($a_node_id) ||
125 $a_permission ==
"visible") {
154 if ($rbacreview->
isAssigned($a_user_id, $obj_id)) {
161 if ($a_user_id == $obj_id) {
189 ?
string $a_extended_data =
null 195 if ($this->tree->getTreeId() == $ilUser->getId() &&
196 $a_object_id == $ilUser->getId()) {
200 $ilDB->manipulate(
"INSERT INTO acl_ws (node_id, object_id, extended_data, tstamp)" .
201 " VALUES (" .
$ilDB->quote($a_node_id,
"integer") .
", " .
202 $ilDB->quote($a_object_id,
"integer") .
"," .
203 $ilDB->quote($a_extended_data,
"text") .
"," .
204 $ilDB->quote(time(),
"integer") .
")");
213 ?
int $a_object_id =
null 217 $query =
"DELETE FROM acl_ws" .
218 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer");
221 $query .=
" AND object_id = " .
$ilDB->quote($a_object_id,
"integer");
224 return $ilDB->manipulate($query);
233 return self::_getPermissions($a_node_id);
244 $ilDB = $DIC->database();
247 $publish_enabled =
$ilSetting->get(
"enable_global_profiles");
251 $set =
$ilDB->query(
"SELECT object_id FROM acl_ws" .
252 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer"));
254 while ($row =
$ilDB->fetchAssoc($set)) {
255 if ($publish_enabled || !in_array($row[
"object_id"], $publish_perm)) {
256 $res[] = (
int) $row[
"object_id"];
266 $set =
$ilDB->query(
"SELECT object_id FROM acl_ws" .
267 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
269 return (
bool)
$ilDB->numRows($set);
277 if (!
$ilSetting->get(
"enable_global_profiles")) {
281 $set =
$ilDB->query(
"SELECT object_id FROM acl_ws" .
282 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
284 return (
bool)
$ilDB->numRows($set);
292 if (!
$ilSetting->get(
"enable_global_profiles")) {
296 $set =
$ilDB->query(
"SELECT object_id FROM acl_ws" .
297 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
299 return (
bool)
$ilDB->numRows($set);
306 $ilUser = $DIC->user();
312 $obj_ids = array_merge($grp_ids, $crs_ids);
313 $obj_ids[] = $ilUser->getId();
316 if (
$ilSetting->get(
"enable_global_profiles")) {
332 $set =
$ilDB->query(
"SELECT DISTINCT(obj.owner), u.lastname, u.firstname, u.title" .
333 " FROM object_data obj" .
334 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
335 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
336 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
337 " JOIN usr_data u on (u.usr_id = obj.owner)" .
338 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
339 " AND obj.owner <> " .
$ilDB->quote($ilUser->getId(),
"integer") .
340 " ORDER BY u.lastname, u.firstname, u.title");
341 while ($row =
$ilDB->fetchAssoc($set)) {
342 $user_ids[$row[
"owner"]] = $row[
"lastname"] .
", " . $row[
"firstname"];
344 $user_ids[$row[
"owner"]] .=
", " . $row[
"title"];
358 $set =
$ilDB->query(
"SELECT ref.wsp_id,obj.obj_id" .
359 " FROM object_data obj" .
360 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
361 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
362 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
363 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
364 " AND obj.owner = " .
$ilDB->quote($a_owner_id,
"integer"));
365 while ($row =
$ilDB->fetchAssoc($set)) {
366 $res[$row[
"wsp_id"]] = $row[
"obj_id"];
373 ?array $a_filter =
null,
374 ?array $a_crs_ids =
null,
375 ?array $a_grp_ids =
null 380 if (!$a_filter[
"acl_type"]) {
383 switch ($a_filter[
"acl_type"]) {
397 $obj_ids = $a_crs_ids;
401 $obj_ids = $a_grp_ids;
405 $obj_ids = array($ilUser->getId());
412 $sql =
"SELECT ref.wsp_id,obj.obj_id,obj.type,obj.title,obj.owner," .
413 "acl.object_id acl_type, acl.tstamp acl_date" .
414 " FROM object_data obj" .
415 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
416 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
417 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
418 " WHERE " .
$ilDB->in(
"acl.object_id", $obj_ids,
"",
"integer") .
419 " AND obj.owner <> " .
$ilDB->quote($ilUser->getId(),
"integer");
421 if ($a_filter[
"obj_type"] ??
false) {
422 $sql .=
" AND obj.type = " .
$ilDB->quote($a_filter[
"obj_type"],
"text");
424 if (($a_filter[
"title"] ??
false) && strlen($a_filter[
"title"]) >= 3) {
425 $sql .=
" AND " .
$ilDB->like(
"obj.title",
"text",
"%" . $a_filter[
"title"] .
"%");
427 if (($a_filter[
"user"] ??
false) && strlen($a_filter[
"user"]) >= 3) {
429 $set =
$ilDB->query(
"SELECT usr_id FROM usr_data" .
430 " WHERE (" .
$ilDB->like(
"login",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
431 "OR " .
$ilDB->like(
"firstname",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
432 "OR " .
$ilDB->like(
"lastname",
"text",
"%" . $a_filter[
"user"] .
"%") .
" " .
433 "OR " .
$ilDB->like(
"email",
"text",
"%" . $a_filter[
"user"] .
"%") .
")");
434 while ($row =
$ilDB->fetchAssoc($set)) {
435 $usr_ids[] = $row[
"usr_id"];
437 if (!
sizeof($usr_ids)) {
440 $sql .=
" AND " .
$ilDB->in(
"obj.owner", $usr_ids,
"",
"integer");
443 if ($a_filter[
"acl_date"] ??
false) {
446 $sql .=
" AND acl.tstamp > " .
$ilDB->quote($dt->get(
IL_CAL_UNIX),
"integer");
449 if ($a_filter[
"crsgrp"] ??
false) {
451 $part = $part->getParticipants();
452 if (!
sizeof($part)) {
455 $sql .=
" AND " .
$ilDB->in(
"obj.owner", $part,
"",
"integer");
459 $sql .=
" ORDER BY acl.tstamp";
461 $set =
$ilDB->query($sql);
462 while ($row =
$ilDB->fetchAssoc($set)) {
463 if (!isset(
$res[$row[
"wsp_id"]])) {
464 $row[
"acl_type"] = array($row[
"acl_type"]);
465 $res[$row[
"wsp_id"]] = $row;
467 $res[$row[
"wsp_id"]][
"acl_type"][] = $row[
"acl_type"];
478 $ilDB = $DIC->database();
480 $set =
$ilDB->query(
"SELECT * FROM acl_ws" .
481 " WHERE node_id = " .
$ilDB->quote($a_node_id,
"integer") .
485 return $res[
"extended_data"];
500 public static function getGotoLink(
int $a_node_id,
int $a_obj_id,
string $a_additional =
""): string
511 $set =
$ilDB->query(
"SELECT ref.wsp_id,obj.obj_id" .
512 " FROM object_data obj" .
513 " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" .
514 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
515 " JOIN acl_ws acl ON (acl.node_id = tree.child)" .
516 " WHERE obj.owner = " .
$ilDB->quote($ilUser->getId(),
"integer"));
517 while ($row =
$ilDB->fetchAssoc($set)) {
518 $res[$row[
"wsp_id"]] = $row[
"obj_id"];
528 $ilDB = $DIC->database();
530 $set =
$ilDB->query(
"SELECT obj.obj_id, obj.type, obj.title" .
531 " FROM object_reference_ws ref" .
532 " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" .
533 " JOIN object_data obj ON (ref.obj_id = obj.obj_id)" .
534 " WHERE ref.wsp_id = " .
$ilDB->quote($a_node_id,
"integer"));
535 return $ilDB->fetchAssoc($set);
542 foreach ($objects as $object_id) {
543 if (!in_array($object_id, $existing,
true)) {
getTree()
Get workspace tree.
static get(string $a_var)
static getPossibleSharedTargets()
hasRegisteredPermission(int $a_node_id)
getSharedObjects(int $a_owner_id)
checkAccess(string $a_permission, string $a_cmd, int $a_node_id, string $a_type="")
addMissingPermissionForObjects(int $node_id, array $objects)
const PERMISSION_ALL_PASSWORD
static getSharedNodePassword(int $a_node_id)
static getInstanceByObjId(int $a_obj_id)
Get instance by obj type.
static getGotoLink(int $a_node_id, int $a_obj_id, string $a_additional="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadLanguageModule(string $a_module)
Load language module.
const PERMISSION_REGISTERED
removePermission(int $a_node_id, ?int $a_object_id=null)
Remove permission[s] (for object) to node.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setPermissions(int $a_parent_node_id, int $a_node_id)
Set permissions after creating node/object.
hasGlobalPermission(int $a_node_id)
static _getInstanceByObjId(int $a_obj_id)
hasGlobalPasswordPermission(int $a_node_id)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
static keepSharedSessionPassword(int $a_node_id, string $a_password)
isAssigned(int $a_usr_id, int $a_role_id)
check if a specific user is assigned to specific role
addPermission(int $a_node_id, int $a_object_id, ?string $a_extended_data=null)
Add permission to node for object.
__construct(?ilTree $a_tree=null)
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
findSharedObjects(?array $a_filter=null, ?array $a_crs_ids=null, ?array $a_grp_ids=null)
checkAccessOfUser(ilTree $a_tree, int $a_user_id, string $a_permission, string $a_cmd, int $a_node_id, string $a_type="")
check access for an object
getPermissions(int $a_node_id)
Get all permissions of node.
static getObjectDataFromNode(int $a_node_id)
static _getPermissions(int $a_node_id)
Get all permissions to node.
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
static _lookupType(int $id, bool $reference=false)
static set(string $a_var, $a_val)
Set a value.
static getSharedSessionPassword(int $a_node_id)