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

**URL:** <https://help.egroupware.org/t/r34972-in-trunk-importexport-inc-setup/47431>\
**Category:** eGW-svn\
**Created:** [May 18, 2011, 2:46pm UTC](https://help.egroupware.org/t/r34972-in-trunk-importexport-inc-setup/47431 "2011-05-18T14:46:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathangray](https://help.egroupware.org/letter_avatar_proxy/v4/letter/n/77aa72/32.png) [@nathangray](https://help.egroupware.org/u/nathangray)\
**Post date:** [May 18, 2011, 2:46pm UTC](https://help.egroupware.org/t/r34972-in-trunk-importexport-inc-setup/47431/1 "2011-05-18T14:46:57Z")

</div>

Author: nathangray  
New Revision: 34972

URL: [http://www.egroupware.org/viewvc/egroupware?rev=34972&view=rev](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](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](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](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](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](http://p.sf.net/sfu/intel-dev2devmay)

* * *

eGroupWare-cvs mailing list  
[eGroupWare-cvs@lists.sourceforge.net](mailto:eGroupWare-cvs@lists.sourceforge.net)  
[https://lists.sourceforge.net/lists/listinfo/egroupware-cvs](https://lists.sourceforge.net/lists/listinfo/egroupware-cvs)
