Loading...
 
Architecture / Installation

Architecture / Installation


File Downloads, Permission, and 1.8.4

posts: 12

Hi,

I cannot download files — according to my tikiwiki site. But I'm the admin!

I have installed and configured tikiwiki on a windows server — everything is working almost perfecly except for a few issues, one of which I mention above. I have a group called GroupA and I have set its permissions similar to group Registered. To set GroupA's permissions I login as admin -> select Groups -> select GroupA's permissions KEY -> scroll to the bottom -> select "File gals" -> scroll to the bottom -> check the tiki_p_admin_file_galleries checkbox -> and click update. I then logout and login back in as a GroupA user (which I have created and assigned to only GroupA and Anonymous). I go to the file gallery section, where I can see the files, I click on one of them and I get "You can not download files". Uhg!

In searching for an answer I came upon another tiki users request for a fix to the same problem:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>I have installed Tikiwiki 1.8.3 as a intranet for a small foundation. Everything works perfectly except for the File Gallery. Uploading files is not a problem at all, but when i want to download one of these files I get a "You can not download files" error message.

The group the user is a member of has permission tiki_p_admin_file_galleries and the File Gallery has only global permissions, so the user should be able to download the file. However the user is unable to download a file, neither is the admin able to download a file.

Here is the weird part, when I change line 42 of tiki-download_file.php from
if($tiki_p_admin_file_galleries == 'y') {
to
if($tiki_p_admin_file_galleries == 'n') {

the download is no problem. But now users without proper permissions can also download the file.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

I went thru the code and saw what the tikiuser above was talking about, but I cannot let anonymous users download files. Is/was there a fix for this? I don't wish to use the level feature to assign permissions to a group — is this a problem? Am I doing something wrong?

Please let me know. Thanks much!

-Patrick


posts: 12

Hey,

Yes, the tiki_p_download_file permission is/was set for the applicable groups. I've also set the tiki_p_admin_file_galleries permission for applicable groups. I set the permissions for all groups to allow file downloads — still nothing!

Here's what I know:

- The permissions are listed in the database and connected to the proper groups

- The permissions are listed under the applicable groups in the Admin->Groups area.

- I put an echo statement after line 43 in tiki-download_file.php to check what the tiki_p_download and tiki_p_admin_file_galleries output — both were "n".

So, the permissions are there, but the code says no. I can upload 1 file at a time without problems, but no downloading for any users from any groups (not even admin).

Any thoughts? This is a strange problem — but an important one where my usage is concerned. I appreciate your time.

-Patrick

posts: 1092

Just some more tests....
Can you move the same print before the check on indivdual perms
$smarty->assign('individual','n'); arount line 24
And the same echo in tiki-setup_base.php just after the perm are assigned just after the block // Get group permissions here before if ($tiki_p_admin_file_galleries == 'y') {

Also the perms are cached, can you clean the cache in admin->system admin

thanks


posts: 12

Hi,

Thanks! I put the echo statements where you said. For the first set of output, I was logged in as a user from one of the groups allowed to download files:

FILE: tiki-setup_base.php, Line: 357 -1- tiki_p_admin_file_galleries = n
FILE: tiki-download.php, Line: 24 -1- tiki_p_admin_file_galleries = n
FILE: tiki-download.php, Line: 25 -2- tiki_p_download = n

I was logged in as admin for next set of output:

As User Patrick of Core
FILE: tiki-setup_base.php -1- tiki_p_admin_file_galleries = n
FILE: tiki-download.php -1- tiki_p_admin_file_galleries = n
FILE: tiki-download.php -2- tiki_p_download = n

I ran the same tests again after I cleared my cache. The permissions for a group allowed to download files are still the same — and still no files downloaded. Hope this helps. Let me know if I can provide you with anymore data.

-Patrick

posts: 12

Oops!

Where it is says "As User Patrick of Core" is a mistake — I was actually logged in as admin. I copied and pasted in the wrong place. Sorry!

-Patrick


posts: 1092

Very strange.
Can you check in the database if you have in users_grouppermissions table a line with
Registered tiki_p_admin_file_galleries
thanks


posts: 12

Sylvie,

First off, thanks for your time. Yes, using phpMyAdmin, I can see that tiki_p_admin_file_galleries is listed with the correct group in the users_grouppermissions table. I'm not using the Registered group. With the way I am using tikiwiki (many groups across the U.S. — all with different needs, thus different permissions), I decided to give them all different names. But, it is true that I started all groups with the same permissions as Registered and changed them from there. What I'm saying is that no users in my setup belong to group "Registered". Is there something in the system that would make tikiwiki not work right if users didn't belong to the default Registered group? Does making another group with the same exact permissions, then assigning a user ONLY to that other group break certain tiki functions?

I ran into another similar problem when trying to get a file attached to a forum thread. The screen just went white! I figured out that a line of code in tiki-download_forum_attachment.php was telling my system to "die" if $tiki_p_forum_attach did not equal 'y' (at line 15). The similarity to my original problem with the file gallery is that, both as admin and a user from another group, $tiki_p_forum_attach was equal to 'n', even though the permission was set for both admin and the group the user belonged to. This struck me as VERY strange, because like the file download problem, everything was where it needed to be in the DB and in the perms list under groups. The strange part is that this permission had always been set for admin and groups, meaning that it couldn't have been a cache thing. Also, I tried setting individual perms for the forum and I got the same error — a blank screen caused by the call to "die".

After commenting out the if statement, viola, I was able to view and download fourm attachments.

The forum attachments problem is not my main area of concern, as I can prevent groups from the ability to see forums that aren't in their space. I am still very concerned with the file download problem from the file gallery. I just thought the above could help, because it deals with a similar permission recognition problem. Hope this helps.

Thanks again,

Patrick


posts: 1092

Let do some summarize:
- in the database you have for groupx tiki_p_admin_file_galleries
- in tiki-setup_base.php just after the loop with "Asignando permiso global", tiki_p_amin_file_galleries is "n". The variable changes value in this loop. It must set to 'y' after.
So .... the problem is in the function get_user_permissions.
Each user belongs only to one group groupx. Right? Can you check in the admin panel...
It is so simple that I can figure out what is the problem

I checked that if a user belongs to a group but not the registered group, it is ok ...

If you can debug php, you can try to put some print
- take away the comment // before "Asignando permiso global"
- put some prints in get_user_permissions to see $groups and $perms for each group

good luck ... very strange