R34972 - in /trunk/importexport: inc/ setup/

Author: nathangray
New Revision: 34972

URL: http://www.egroupware.org/viewvc/egroupware?rev=34972&view=rev
Log:
Apply ACL to definition list - only show definitions user can use

Modified:
trunk/importexport/inc/class.importexport_definition.inc.php
trunk/importexport/inc/class.importexport_definitions_bo.inc.php
trunk/importexport/setup/setup.inc.php
trunk/importexport/setup/tables_update.inc.php

Modified: trunk/importexport/inc/class.importexport_definition.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/importexport/inc/class.importexport_definition.inc.php?rev=34972&r1=34971&r2=34972&view=diff

— trunk/importexport/inc/class.importexport_definition.inc.php (original)
+++ trunk/importexport/inc/class.importexport_definition.inc.php Wed May 18 16:46:57 2011
@@ -136,7 +136,7 @@
* @return array
*/
private function get_allowed_users() {

  •   return explode(',',$this->definition['allowed_users']);
    
  •   return explode(',',substr($this->definition['allowed_users'],1,-1));
    

    }

    /**
    @@ -145,7 +145,7 @@

    • @param array $_allowed_users
      */
      private function set_allowed_users( $_allowed_users ) {
  •   $this->definition['allowed_users'] = implode(',',(array)$_allowed_users);
    
  •   $this->definition['allowed_users'] = ','.implode(',',(array)$_allowed_users) .',';
    

    }

    /**

Modified: trunk/importexport/inc/class.importexport_definitions_bo.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/importexport/inc/class.importexport_definitions_bo.inc.php?rev=34972&r1=34971&r2=34972&view=diff

— trunk/importexport/inc/class.importexport_definitions_bo.inc.php (original)
+++ trunk/importexport/inc/class.importexport_definitions_bo.inc.php Wed May 18 16:46:57 2011
@@ -42,9 +42,29 @@

public function get_rows(&$query, &$rows, &$readonlys)
{
  •   // Filter only definitions user is allowed to use
    
  •   if(!$GLOBALS['egw_info']['user']['apps']['admin']) {
    
  •   	$this_membership = $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true);
    
  •   	$this_membership[] = $GLOBALS['egw_info']['user']['account_id'];
    
  •   	$sql .= ' (';
    
  •   	$read = array();
    
  •   	foreach($this_membership as $id)
    
  •   	{
    
  •   		$read[] = 'allowed_users '.
    
  •   			$GLOBALS['egw']->db->capabilities['case_insensitive_like'].' '.
    
  •   			$GLOBALS['egw']->db->quote('%,'.str_replace('_','\\_',$id) .',%');
    
  •   	}
    
  •   	$sql .= implode(' OR ', $read);
    
  •   	$sql .= ') ';
    
  •   	$query['col_filter'][] = $sql;
    
  •   }
    
  •   $total = $this->so_sql->get_rows($query, $rows, $readonlys);
      $ro_count = 0;
    
  •   foreach($rows as $row) {
    
  •   foreach($rows as &$row) {
    
  •   	// Strip off leading + trailing ,
    
  •   	$row['allowed_users'] = substr($row['allowed_users'],1,-1);
    
  •   	$readonlys["edit[{$row['definition_id']}]"] = $readonlys["delete[{$row['definition_id']}]"] = 
      		($row['owner'] != $GLOBALS['egw_info']['user']['account_id']) &&
      		!$GLOBALS['egw_info']['user']['apps']['admin'];
    

Modified: trunk/importexport/setup/setup.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/importexport/setup/setup.inc.php?rev=34972&r1=34971&r2=34972&view=diff

— trunk/importexport/setup/setup.inc.php (original)
+++ trunk/importexport/setup/setup.inc.php Wed May 18 16:46:57 2011
@@ -10,7 +10,7 @@
*/

$setup_info[‘importexport’][‘name’] = ‘importexport’;
-$setup_info[‘importexport’][‘version’] = ‘1.9.002’;
+$setup_info[‘importexport’][‘version’] = ‘1.9.003’;
$setup_info[‘importexport’][‘app_order’] = 2;
$setup_info[‘importexport’][‘enable’] = 2;
$setup_info[‘importexport’][‘tables’] = array(‘egw_importexport_definitions’);

Modified: trunk/importexport/setup/tables_update.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/importexport/setup/tables_update.inc.php?rev=34972&r1=34971&r2=34972&view=diff

— trunk/importexport/setup/tables_update.inc.php (original)
+++ trunk/importexport/setup/tables_update.inc.php Wed May 18 16:46:57 2011
@@ -60,3 +60,11 @@
// Not needed - did it wrong
return $GLOBALS[‘setup_info’][‘importexport’][‘currentver’] = ‘1.9.002’;
}
+function importexport_upgrade1_9_002()
+{

  • $sql = 'UPDATE egw_importexport_definitions SET allowed_users = '.
  • $GLOBALS[‘egw_setup’]->db->concat("’,’", ‘allowed_users’, “’,’”);
  •    $GLOBALS['egw_setup']->oProc->query($sql, __LINE__, __FILE__);
    
  • return $GLOBALS[‘setup_info’][‘importexport’][‘currentver’] = ‘1.9.003’;
    +}

What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its
next-generation tools to help Windows* and Linux* C/C++ and Fortran
developers boost performance applications - including clusters.
http://p.sf.net/sfu/intel-dev2devmay


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