[TYPO3-dam] ce_gallery, dam categories and a little bit of be user permissions issues

Eduard Renger eduard at renger.info
Tue Sep 19 23:44:58 CEST 2006


Hi Brian,

I think I got it.
As I mentioned earlier what I did first is install the extension
ch_treeview.

Then I changed the file flexform_ds_pi1.xml and put the following code in
the config section of the <categoryView>

	<type>select</type>
	<form_type>user</form_type>
	<treeView>1</treeView>
	<treeName>txchtreeviewexample</treeName>
	<userFunc>tx_ch_treeview->displayCategoryTree</userFunc>
	<foreign_table>tx_dam_cat</foreign_table>
	<size>10</size>
	<autoSizeMax>20</autoSizeMax>
	<minitems>0</minitems>
	<maxitems>120</maxitems>

That gave me a treeview rather than just a list.

To get the permissions right I did the following.
In the file class.tx_ch_treeview.php (inside lib dir of ch_treeview
extension) I added the following lines right after
			$treeViewObj->title =
$LANG->sL($TCA[$config['foreign_table']]['ctrl']['title']);
			$treeViewObj->thisScript = 'alt_doc.php';
			$treeViewObj->treeName = $config['treeName'];
// new lines below
			$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
				'tx_dam_mountpoints',
				'be_users',
				'uid='.$GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->user["uid
"])
			);
			while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))	{
				$temp_mount = $row['tx_dam_mountpoints'];
			}
			$temp_mount_list = ereg_replace('txdamCat:', '', $temp_mount);
			if (substr($temp_mount_list, -1) == ',') {
				$mount_list = substr($temp_mount_list, 0, -1);
			} else {
				$mount_list = $temp_mount_list;
			}
			$mount_array = explode (',',$mount_list);
			$GLOBALS['TYPO3_DB']->sql_free_result($res);
			$treeViewObj->MOUNTS = $mount_array;

// and before the lines
			$treeViewObj->hiddenField = '<input type="hidden"
name="'.$config['treeName'].'_pm" value="">';

			$treeViewObj->TCEforms_itemFormElName = $PA['itemFormElName'];
			if ($table==$config['foreign_table']) {
				$treeViewObj->TCEforms_nonSelectableItemsArray[] = $row['uid'];
			}

Basically what this does, is get the tx_dam_mountpoints for the backend user
from the be_users table puts them in an array and assings the array to the
internal variable MOUNTS
That does the trick.

This is my very first piece of code where I actually managed to get someting
from the database inside Typo3 so the code must look awful to some of you,
so please improve it if you like.

Hope this helps.
Cheers.
Eduard
p.s. sorry for the long post.


-----Oorspronkelijk bericht-----
Van: typo3-project-dam-bounces at lists.netfielders.de
[mailto:typo3-project-dam-bounces at lists.netfielders.de]Namens Brian Bendtsen
Verzonden: donderdag 14 september 2006 0:04
Aan: typo3-project-dam at lists.netfielders.de
Onderwerp: [TYPO3-dam] ce_gallery, dam categories and a little bit of be
user permissions issues


Hi list

Im trying to set up the following:

- multiple dam categories
- multiples backend users
- ce_gallery
- Every backend user can create dam categories
- Every backend user has a page with a ce_gallery extension
- On this page the backend user can add the categories they have created

Problem: any backend user can see all DAM categories even though I have
specifically assigned each backend user with a seperate DAM categori
upon creation.

Any ideas on how to solve this?

/Brian Bendtsen


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.5/450 - Release Date: 18-9-2006




More information about the TYPO3-project-dam mailing list