R35504 - in /trunk/timesheet/inc: class.timesheet_bo.inc.php class.timesheet_hooks.inc.php

Author: ralfbecker
New Revision: 35504

URL: http://svn.stylite.de/viewvc/egroupware?rev=35504&view=rev
Log:
file_access_user implementation for timesheet

Modified:
trunk/timesheet/inc/class.timesheet_bo.inc.php
trunk/timesheet/inc/class.timesheet_hooks.inc.php

Modified: trunk/timesheet/inc/class.timesheet_bo.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/timesheet/inc/class.timesheet_bo.inc.php?rev=35504&r1=35503&r2=35504&view=diff

— trunk/timesheet/inc/class.timesheet_bo.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_bo.inc.php Sun Jun 26 16:29:35 2011
@@ -5,7 +5,7 @@

    • @todo Implement sorting&filtering by and searching of custom fields
      /
      class timesheet_bo extends so_sql_cf
      {
      @@ -37,15 +35,15 @@
      /
      var $quantity_sum=false;
      /
    • current user
    • @var int
  • */
  • var $user;
  • /**
    • Timestaps that need to be adjusted to user-time on reading or saving
    • @var array
  • */
  • var $user;
  • /**
    • current user
    • @var int
      */
      var $timestamps = array(
      ‘ts_start’,‘ts_modified’
      @@ -175,7 +173,7 @@
      {
      $this->status_labels =& $this->config_data[‘status_labels’];
      if (!is_array($this->status_labels)) $this->status_labels= array($this->status_labels);
  •   foreach ($this->status_labels as $status_id => $label)
      {
      	if (!is_array($label))
    

@@ -267,12 +265,12 @@
* Rights are given via owner grants or role based acl
*
* @param int $required EGW_ACL_READ, EGW_ACL_WRITE, EGW_ACL_ADD, EGW_ACL_DELETE, EGW_ACL_BUDGET, EGW_ACL_EDIT_BUDGET

    • @param array/int $data=null project or project-id to use, default the project in $this->data
    • @param array|int $data=null project or project-id to use, default the project in $this->data
    • @param int $user=null for which user to check, default current user
    • @return boolean true if the rights are ok, null if not found, false if no rights
      */
  • function check_acl($required,$data=null)
  • {
  •   //error_log(__METHOD__."($required,".array2string($data).")");
    
  • function check_acl($required,$data=null,$user=null)

  • {
    if (is_null($data) || (int)$data == $this->data[‘ts_id’])
    {
    $data =& $this->data;
    @@ -285,9 +283,19 @@

    	if (!$data) return null; 	// entry not found
    }
    
  •   $rights = $this->grants[$data['ts_owner']];
    
  •   return $data && !!($rights & $required);
    
  •   if (!$user) $user = $this->user;
    
  •   if ($user == $this->user)
    
  •   {
    
  •   	$grants = $this->grants;
    
  •   }
    
  •   else
    
  •   {
    
  •   	$grants = $GLOBALS['egw']->acl->get_grants(TIMESHEET_APP,true,$user);
    
  •   }
    
  •   $ret = $data && !!($grants[$data['ts_owner']] & $required);
    
  •   //error_log(__METHOD__."($required,$data[ts_id],$user) returning ".array2string($ret));
    
  •   return $ret;
    

    }

    /**
    @@ -371,7 +379,7 @@
    *

    • reimplemented to limit result to users we have grants from
    • @param array/string $criteria array of key and data cols, OR a SQL query (content for WHERE), fully quoted (!)
    • @param array|string $criteria array of key and data cols, OR a SQL query (content for WHERE), fully quoted (!)
    • @param boolean/string $only_keys=true True returns only keys, False returns all cols. comma seperated list of keys to return
    • @param string $order_by=’’ fieldnames + {ASC|DESC} separated by colons ‘,’, can also contain a GROUP BY (if it contains ORDER BY)
    • @param string/array $extra_cols=’’ string or array of strings to be added to the SELECT, eg. “count(*) as num”
      @@ -474,7 +482,7 @@
    • @param int $ts_id
    • @param boolean $ignore_acl=false should the acl be checked
    • @return array/boolean array with timesheet entry, null if timesheet not found or false if no rights
    • @return array|boolean array with timesheet entry, null if timesheet not found or false if no rights
      */
      function read($ts_id,$ignore_acl=false)
      {
      @@ -700,15 +708,17 @@
      }
/**
    • Check access to the projects file store
    • @param int $id id of entry
    • Check access to the file store
    • @param int|array $id id of entry or entry array
    • @param int $check EGW_ACL_READ for read and EGW_ACL_EDIT for write or delete access
    • @param string $rel_path=null currently not used in InfoLog
    • @param int $user=null for which user to check, default current user
    • @return boolean true if access is granted or false otherwise
      */
  • function file_access($id,$check,$rel_path)
  • {
  •   return $this->check_acl($check,$id);
    
  • function file_access($id,$check,$rel_path=null,$user=null)

  • {

  •   return $this->check_acl($check,$id,$user);
    

    }

    /**

Modified: trunk/timesheet/inc/class.timesheet_hooks.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/timesheet/inc/class.timesheet_hooks.inc.php?rev=35504&r1=35503&r2=35504&view=diff

— trunk/timesheet/inc/class.timesheet_hooks.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_hooks.inc.php Sun Jun 26 16:29:35 2011
@@ -5,7 +5,7 @@

  •   	'file_access_user' => true,	// file_access supports 4th parameter $user
      );
    
    }

All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs