User unable to delete uploaded files
Page: 1
Hi,
I have come across a problem today and would appreciate some advice. I have a user who belongs to a client and I have given him "All" permissions to a particular project. I thought that having all permissions would mean that he would see the "Delete" link when he looks at a file listing. However he does not, and hence is unable to delete files that he has uploaded.
I have not previously seen this because I use the service as admin and to be honest no-one else has ever wanted to delete a file before!
So, can anyone enlighten me?
Thanks,
Ian.
--
I have come across a problem today and would appreciate some advice. I have a user who belongs to a client and I have given him "All" permissions to a particular project. I thought that having all permissions would mean that he would see the "Delete" link when he looks at a file listing. However he does not, and hence is unable to delete files that he has uploaded.
I have not previously seen this because I use the service as admin and to be honest no-one else has ever wanted to delete a file before!
So, can anyone enlighten me?
Thanks,
Ian.
--
Ilija Studen
on Jun 15. 2007. 1:01 pm
Only administrators can delete files (don't ask me why, from some reason it seamed like a good idea back than :) ).
To change that behavior you'll need to hack ProjectFile class and alter canDelete() function (somewhere around line 488). ProjectFile class is defined in:
/application/models/project_files/ProjectFile.class.php
To change that behavior you'll need to hack ProjectFile class and alter canDelete() function (somewhere around line 488). ProjectFile class is defined in:
/application/models/project_files/ProjectFile.class.php
activeCollab team member
Thanks, that answers my question. I will take a look at the code and see whether hacking it is something I can cope with :-)
Ian.
--
Ian.
--
I just looked at the code. From the comment above the code it seems to be refering to comments rather than files.
/**
* Check if specific user can delete this comment
*
* @access public
* @param User $user
* @return boolean
*/
function canDelete(User $user) {
if(!$user->isProjectUser($this->getProject())) {
return false;
} // if
if($user->isAdministrator()) {
return true;
} // if
return false;
} // canDelete
Am I looking in the right place?
Ian.
--
/**
* Check if specific user can delete this comment
*
* @access public
* @param User $user
* @return boolean
*/
function canDelete(User $user) {
if(!$user->isProjectUser($this->getProject())) {
return false;
} // if
if($user->isAdministrator()) {
return true;
} // if
return false;
} // canDelete
Am I looking in the right place?
Ian.
--
Ilija Studen
on Jun 16. 2007. 2:33 am
No, it is related with the file (docblock is not correct, most probably I just copied permissions methods from comment class and altered them without changing documentation messages).
activeCollab team member
Excellent, thanks. If I read this code correctly then any project user (isProjectUser is true) would be able to delete files - does that override any permissions that I explicitly set in the permissions window for a user?
(I am assuming that I need just to change the final "return false" in the function to "return true")
Ian.
--
(I am assuming that I need just to change the final "return false" in the function to "return true")
Ian.
--
Ilija Studen
on Jun 16. 2007. 4:33 am
No. It means that if user is NOT project user he will not have delete permissions.
If you change final return false; to return true; any user that is member of that project will be able to delete files. That is too lax IMO. Change the function to something like this:
This way person who uploaded the file will be able to delete is as well.
If you change final return false; to return true; any user that is member of that project will be able to delete files. That is too lax IMO. Change the function to something like this:
/**
* Check if specific user can delete this comment
*
* @access public
* @param User $user
* @return boolean
*/
function canDelete(User $user) {
if(!$user->isProjectUser($this->getProject())) {
return false;
} // if
if($user->isAdministrator()) {
return true;
} // if
if($this->getCreatedById() == $user->getId()) {
return true;
}
return false;
} // canDeleteThis way person who uploaded the file will be able to delete is as well.
activeCollab team member
Topic is locked. If you have something important to say about issues discussed on this page please write at hi@a51dev.com.



