Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
diff -u -r a/components/com_phocadownload/views/user/view.html.php b/components/com_phocadownload/com_phocadownload/views/user/view.html.php
--- a/components/com_phocadownload/views/user/view.html.php 2015-02-20 08:27:48.000000000 -0800
+++ b.components/com_phocadownload/com_phocadownload/views/user/view.html.php 2015-03-05 10:26:43.000000000 -0800
@@ -219,7 +219,15 @@
//}
//$whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%".(int)$user->id."%')";
//$whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,{".(int)$user->id."}' OR cc.uploaduserid LIKE '{".(int)$user->id."},%' OR cc.uploaduserid LIKE '%,{".(int)$user->id."},%' OR cc.uploaduserid ={".(int)$user->id."} )";
- $whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,".(int)$user->id."' OR cc.uploaduserid LIKE '".(int)$user->id.",%' OR cc.uploaduserid LIKE '%,".(int)$user->id.",%' OR cc.uploaduserid =".(int)$user->id." )";
+ //$whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,".(int)$user->id."' OR cc.uploaduserid LIKE '".(int)$user->id.",%' OR cc.uploaduserid LIKE '%,".(int)$user->id.",%' OR cc.uploaduserid =".(int)$user->id." )";
+ $userMatch = "(cc.uploaduserid LIKE '%-1' OR cc.uploaduserid LIKE '%-1,' OR cc.uploaduserid LIKE '%,".(int)$user->id."' OR cc.uploaduserid LIKE '".(int)$user->id.",%' OR cc.uploaduserid LIKE '%,".(int)$user->id.",%' OR cc.uploaduserid =".(int)$user->id;
+ foreach (JFactory::getUser($user->id)->getAuthorisedViewLevels() as $level) {
+ if($level != 1) {
+ $userMatch .= " OR cc.uploaduserid LIKE '%+" . $level . "' OR cc.uploaduserid LIKE '%+".$level.",'";
+ }
+ }
+ $userMatch .= ")";
+ $whereC[] = $userMatch;
$whereC = ( count( $whereC ) ? ' WHERE '. implode( ' AND ', $whereC ) : '' );
// get list of categories for dropdown filter
Sorry the above post is all out of order.New accounts need review before posts go thorugh, and this forum limits the maximal post length. Hopefully my '2nd post' arrives shortly, and the above patch will make more sense.
The idea of the patch is that viewaccess ids are stored in the access list as '+<id>', and all queries of the access lists are then updated to understand this syntax.
The patch has 3 parts:
1) change getUserRight() to allow matching the <upload/access/delete>userid value in phocadownload_categories against '+<id>' where <id> is from the 'viewlevels' table
2) add a query into the admin page so that the access lists are choosable for Access/Upload/Download
3) on the user upload page, add support for '+<id>' syntax in finding all uploadable categories for the combo-box
yes, it is all complete now (and in order even). As I mentioned at the top, this is developed for phocadownload 3.0.6. It will probably need modifications to work with any other version. I do not guarantee that I found every case where 'accessuserid' is used (i.e. using a group in the 'Access Rights' filed is not recommended). PhocaDownload already supports category authorization filtering by groups using the 'Access' field. The purpose of this patch is primarily to easily let a group of users upload to specific categories without needing to add them individually. The delete-authorization is tested and works as well. The fact that groups show up in 'Access Rights' is just a side-effect. As I said at the top, the patch is somewhat crude.