ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRbacLog Class Reference

class ilRbacLog Log changes in Rbac-related settings More...

+ Collaboration diagram for ilRbacLog:

Static Public Member Functions

static isActive ()
static gatherFaPa ($a_ref_id, array $a_role_ids, $a_add_action=false)
static diffFaPa (array $a_old, array $a_new)
static gatherTemplate ($a_role_folder_ref_id, $a_role_id)
static diffTemplate (array $a_old, array $a_new)
static add ($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
static getLogItems ($a_ref_id, $a_limit, $a_offset, array $a_filter=NULL)
static delete ($a_ref_id)
static garbageCollection ()

Data Fields

const EDIT_PERMISSIONS = 1
const MOVE_OBJECT = 2
const LINK_OBJECT = 3
const COPY_OBJECT = 4
const CREATE_OBJECT = 5
const EDIT_TEMPLATE = 6
const EDIT_TEMPLATE_EXISTING = 7
const CHANGE_OWNER = 8

Static Protected Member Functions

static isValidAction ($a_action)

Detailed Description

class ilRbacLog Log changes in Rbac-related settings

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id:
class.ilRbacReview.php 24262 2010-06-15 06:48:14Z nkrzywon

Definition at line 14 of file class.ilRbacLog.php.

Member Function Documentation

static ilRbacLog::add (   $a_action,
  $a_ref_id,
array  $a_diff,
  $a_source_ref_id = false 
)
static

Definition at line 164 of file class.ilRbacLog.php.

References $ilDB.

Referenced by ilRbacAdmin\adjustMovedObjectPermissions(), ilObjRole\adjustPermissions(), ilPermission2GUI\changeOwner(), ilSoapUtils\cloneNode(), ilObjChatroom\cloneObject(), ilObjectCopyGUI\copySingleObject(), ilObjChatroomGUI\insertObject(), ilSoapUtils\linkNode(), ilContainerGUI\performPasteIntoMultipleObjectsObject(), ilPermission2GUI\permSave(), ilObjRoleGUI\permSaveObject(), ilObject2GUI\putObjectInTree(), ilObjectGUI\putObjectInTree(), and ilPermissionGUI\savePermissions().

{
global $ilUser, $ilDB;
if(self::isValidAction($a_action) && sizeof($a_diff))
{
if($a_source_ref_id)
{
$a_diff["src"] = $a_source_ref_id;
}
$ilDB->query("INSERT INTO rbac_log (user_id, created, ref_id, action, data)".
" VALUES (".$ilDB->quote($ilUser->getId(), "integer").",".$ilDB->quote(time(), "integer").
",".$ilDB->quote($a_ref_id, "integer").",".$ilDB->quote($a_action, "integer").
",".$ilDB->quote(serialize($a_diff), "text").")");
return true;
}
return false;
}

+ Here is the caller graph for this function:

static ilRbacLog::delete (   $a_ref_id)
static

Definition at line 239 of file class.ilRbacLog.php.

References $ilDB, and garbageCollection().

{
global $ilDB;
$ilDB->query("DELETE FROM rbac_log WHERE ref_id = ".$ilDB->quote($a_ref_id, "integer"));
}

+ Here is the call graph for this function:

static ilRbacLog::diffFaPa ( array  $a_old,
array  $a_new 
)
static

Definition at line 79 of file class.ilRbacLog.php.

References $result.

Referenced by ilRbacAdmin\adjustMovedObjectPermissions(), ilObjRole\adjustPermissions(), ilPermission2GUI\permSave(), and ilPermissionGUI\savePermissions().

{
$result = array();
// roles
foreach((array) $a_old["ops"] as $role_id => $ops)
{
$diff = array_diff($ops, $a_new["ops"][$role_id]);
if(sizeof($diff))
{
$result["ops"][$role_id]["rmv"] = array_values($diff);
}
$diff = array_diff($a_new["ops"][$role_id], $ops);
if(sizeof($diff))
{
$result["ops"][$role_id]["add"] = array_values($diff);
}
}
if(isset($a_old["inht"]) || isset($a_new["inht"]))
{
if(isset($a_old["inht"]) && !isset($a_new["inht"]))
{
$result["inht"]["rmv"] = $a_old["inht"];
}
else if(!isset($a_old["inht"]) && isset($a_new["inht"]))
{
$result["inht"]["add"] = $a_new["inht"];
}
else
{
$diff = array_diff($a_old["inht"], $a_new["inht"]);
if(sizeof($diff))
{
$result["inht"]["rmv"] = array_values($diff);
}
$diff = array_diff($a_new["inht"], $a_old["inht"]);
if(sizeof($diff))
{
$result["inht"]["add"] = array_values($diff);
}
}
}
return $result;
}

+ Here is the caller graph for this function:

static ilRbacLog::diffTemplate ( array  $a_old,
array  $a_new 
)
static

Definition at line 133 of file class.ilRbacLog.php.

References $result.

Referenced by ilObjRoleGUI\permSaveObject().

{
$result = array();
$types = array_unique(array_merge(array_keys($a_old), array_keys($a_new)));
foreach($types as $type)
{
if(!isset($a_old[$type]))
{
$result[$type]["add"] = $a_new[$type];
}
else if(!isset($a_new[$type]))
{
$result[$type]["rmv"] = $a_old[$type];
}
else
{
$diff = array_diff($a_old[$type], $a_new[$type]);
if(sizeof($diff))
{
$result[$type]["rmv"] = array_values($diff);
}
$diff = array_diff($a_new[$type], $a_old[$type]);
if(sizeof($diff))
{
$result[$type]["add"] = array_values($diff);
}
}
}
return $result;
}

+ Here is the caller graph for this function:

static ilRbacLog::garbageCollection ( )
static

Definition at line 248 of file class.ilRbacLog.php.

References $ilDB, and ilPrivacySettings\_getInstance().

Referenced by delete().

{
global $ilDB;
include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php";
$max = $settings->getRbacLogAge();
$ilDB->query("DELETE FROM rbac_log WHERE created < ".$ilDB->quote(strtotime("-".$max."months"), "integer"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilRbacLog::gatherFaPa (   $a_ref_id,
array  $a_role_ids,
  $a_add_action = false 
)
static

Definition at line 36 of file class.ilRbacLog.php.

References $result.

Referenced by ilRbacAdmin\adjustMovedObjectPermissions(), ilObjRole\adjustPermissions(), ilSoapUtils\cloneNode(), ilObjChatroom\cloneObject(), ilObjectCopyGUI\copySingleObject(), ilObjChatroomGUI\insertObject(), ilSoapUtils\linkNode(), ilContainerGUI\performPasteIntoMultipleObjectsObject(), ilPermission2GUI\permSave(), ilObject2GUI\putObjectInTree(), ilObjectGUI\putObjectInTree(), and ilPermissionGUI\savePermissions().

{
global $rbacreview;
$result = array();
// #10946 - if result is written to log directly we need to add an "action" dimension
// if result is used as input to diffFaPa() we need "raw" data
// roles
foreach($a_role_ids as $role_id)
{
if ($role_id != SYSTEM_ROLE_ID)
{
if($a_add_action)
{
$result["ops"][$role_id]["add"] = $rbacreview->getRoleOperationsOnObject($role_id, $a_ref_id);
}
else
{
$result["ops"][$role_id] = $rbacreview->getRoleOperationsOnObject($role_id, $a_ref_id);
}
}
}
// inheritance
$rolf_data = $rbacreview->getRoleFolderOfObject($a_ref_id);
$rolf_id = $rolf_data["child"];
if($rolf_id && $rolf_id != ROLE_FOLDER_ID)
{
if($a_add_action)
{
$result["inht"]["add"] = $rbacreview->getRolesOfRoleFolder($rolf_id);
}
else
{
$result["inht"] = $rbacreview->getRolesOfRoleFolder($rolf_id);
}
}
return $result;
}

+ Here is the caller graph for this function:

static ilRbacLog::gatherTemplate (   $a_role_folder_ref_id,
  $a_role_id 
)
static

Definition at line 126 of file class.ilRbacLog.php.

Referenced by ilObjRoleGUI\permSaveObject().

{
global $rbacreview;
return $rbacreview->getAllOperationsOfRole($a_role_id, $a_role_folder_ref_id);
}

+ Here is the caller graph for this function:

static ilRbacLog::getLogItems (   $a_ref_id,
  $a_limit,
  $a_offset,
array  $a_filter = NULL 
)
static

Definition at line 195 of file class.ilRbacLog.php.

References $ilDB, $result, $row, and IL_CAL_UNIX.

Referenced by ilRbacLogTableGUI\getItems().

{
global $ilDB, $rbacreview;
if($a_filter)
{
$where = NULL;
if($a_filter["action"])
{
$where[] = "action = ".$ilDB->quote($a_filter["action"], "integer");
}
if($a_filter["date"]["from"])
{
$from = $a_filter["date"]["from"]->get(IL_CAL_UNIX);
$from = strtotime("00:00:00", $from);
$where[] = "created >= ".$ilDB->quote($from, "integer");
}
if($a_filter["date"]["to"])
{
$to = $a_filter["date"]["to"]->get(IL_CAL_UNIX);
$to = strtotime("23:59:59", $to);
$where[] = "created <= ".$ilDB->quote($to, "integer");
}
if(sizeof($where))
{
$where = " AND ".implode(" AND ", $where);
}
}
$set = $ilDB->query("SELECT COUNT(*) FROM rbac_log WHERE ref_id = ".$ilDB->quote($a_ref_id, "integer").$where);
$count = array_pop($ilDB->fetchAssoc($set));
$ilDB->setLimit($a_limit, $a_offset);
$set = $ilDB->query("SELECT * FROM rbac_log WHERE ref_id = ".$ilDB->quote($a_ref_id, "integer").
$where." ORDER BY created DESC");
$result = array();
while($row = $ilDB->fetchAssoc($set))
{
$row["data"] = unserialize($row["data"]);
}
return array("cnt"=>$count, "set"=>$result);
}

+ Here is the caller graph for this function:

static ilRbacLog::isActive ( )
static

Definition at line 25 of file class.ilRbacLog.php.

References ilPrivacySettings\_getInstance().

Referenced by ilPermission2GUI\__initSubTabs(), ilRbacAdmin\adjustMovedObjectPermissions(), ilObjRole\adjustPermissions(), ilPermission2GUI\changeOwner(), ilObjectCopyGUI\copySingleObject(), ilPermission2GUI\log(), ilContainerGUI\performPasteIntoMultipleObjectsObject(), and ilObjRoleGUI\permSaveObject().

{
include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php";
if($settings->enabledRbacLog())
{
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilRbacLog::isValidAction (   $a_action)
staticprotected

Definition at line 184 of file class.ilRbacLog.php.

{
if(in_array($a_action, array(self::EDIT_PERMISSIONS, self::MOVE_OBJECT, self::LINK_OBJECT,
self::COPY_OBJECT, self::CREATE_OBJECT, self::EDIT_TEMPLATE, self::EDIT_TEMPLATE_EXISTING,
self::CHANGE_OWNER)))
{
return true;
}
return false;
}

Field Documentation

const ilRbacLog::CHANGE_OWNER = 8
const ilRbacLog::COPY_OBJECT = 4
const ilRbacLog::EDIT_PERMISSIONS = 1
const ilRbacLog::EDIT_TEMPLATE = 6
const ilRbacLog::EDIT_TEMPLATE_EXISTING = 7
const ilRbacLog::LINK_OBJECT = 3
const ilRbacLog::MOVE_OBJECT = 2

The documentation for this class was generated from the following file: