Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't delete a file if it wasn't assigned to a user or a group #9

Closed
bchhun opened this issue Oct 7, 2014 · 14 comments
Closed

Can't delete a file if it wasn't assigned to a user or a group #9

bchhun opened this issue Oct 7, 2014 · 14 comments

Comments

@bchhun
Copy link

bchhun commented Oct 7, 2014

I'm not sure whether this is a bug or a feature but here it goes.

Although a confirmation message is shown, it seems we can't delete a file if we didn't assigned it to a user or a group beforehand.

Steps to reproduce it

  1. Upload a file
  2. Don't assign it to any user or group
  3. Try to delete it using the table interface in manage-file.php

Symptoms

There's no value attribute for the file's checkbox because the id comes from the files_relations table and we don't have any entry there...

And it stays that way during the whole deletion process until the confirmation message.

Possible solutions

  1. Show a warning message mentionning we need to assign a file before we can delete it
  2. Don't use the files_relations's file id and stick with the id from the files table
@andreas-stricker
Copy link

i also can not delete files as a system administrator or other user.
Is there a solution?

@bchhun
Copy link
Author

bchhun commented Feb 4, 2015

@strigga yes. you need to assign the file you want to delete to a user or a group and then delete it.

@andreas-stricker
Copy link

Thank you. This works!
But why does it not assign automatically to the user who has uploaded the file?

So if i have 50 files and want to delete it i have to click on every single file - assign it to a user and after that i can delete it?

@bchhun
Copy link
Author

bchhun commented Feb 5, 2015

My best guess is that you may upload files for other users and assign them whenever you want.

Yes for the mass deletion :)

@ignacionelson
Copy link
Collaborator

r582 includes this fix. Closing the issue now.

@bchhun
Copy link
Author

bchhun commented Jun 9, 2015

+1

@ignacionelson
Copy link
Collaborator

Have you tried the latest version? r582

@riczito
Copy link

riczito commented Oct 9, 2015

On r582 the problem still persists. As an admin, I cannot delete user files, whether they are assigned to users or not. As a user, I cannot delete my own files from my workspace. This is pretty essential functionality. Please help find a solution or workaround!

@tekopsinc
Copy link

Yes, the problem still persists. It does not delete the file(s) no matter what you do. Version r582 confirmed.

@semaphorism
Copy link

It looks like that $file_id in manage_files.php at line 537 is referencing the wrong ID (from tbl_files_relations rather than tbl_files as expected by the delete function). My fix was to change line 537 to read:

<td><input type="checkbox" name="files[]" value="<?php echo $row['id']; ?>" /></td>

I can't remember if that's all I did to fix this problem, but it's a start. Good luck.

@lenamtl
Copy link
Collaborator

lenamtl commented Jan 4, 2016

Do you have an error message?

@ashes00
Copy link

ashes00 commented Jan 21, 2016

semaphorism - I was able to make just the change that you mentioned, and it fixed my issue. I was not able to delete ANY file before. Now I can. Thank you!
,Ash

@tekopsinc
Copy link

We made the change (and it's manage-files.php, not manage_files.php) and it works great. Thank you so much!

@luisalmeidarealbase
Copy link

@semaphorism thank you for your solution. It worked! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants