[Feature Request] allow upload by access-level (w/ patch)
Posted: 05 Mar 2015, 21:08
I wanted to be able to define which users can upload to which categories by access-level rather than by userid
The following (crude) patch accomplishes this for the 3.0.6 Phoca release. There is probably a better way, but this works for me:
part1:
The following (crude) patch accomplishes this for the 3.0.6 Phoca release. There is probably a better way, but this works for me:
part1:
Code: Select all
diff -u -r a/administrator/components/com_phocadownload/libraries/phocadownload/access/access.php b/administrator/components/com_phocadownload/com_phocadownload/libraries/phocadownload/access/access.php
--- a/administrator/components/com_phocadownload/libraries/phocadownload/access/access.php 2015-02-20 08:27:48.000000000 -0800
+++ b/administrator/components/com_phocadownload/com_phocadownload/libraries/phocadownload/access/access.php 2015-03-05 10:37:31.000000000 -0800
@@ -84,7 +84,15 @@
// Check if the user is contained in selected array
$userIsContained = 0;
foreach ($rightUsersIdArray as $key => $value) {
- if ($userId == $value) {
+ if($value[0] == '+') {
+ $value = substr($value, 1);
+ $userLevels = JFactory::getUser($userId)->getAuthorisedViewLevels();
+ if (in_array($value, $userLevels)) {
+ $userIsContained = 1;
+ break;
+ }
+ continue;
+ } elseif ($userId == $value) {
$userIsContained = 1;// check if the user id is selected in multiple box
break;// don't search again
}