All questions about EDocman extension

Private user files

More
8 years 7 months ago #69486 by John
Private user files was created by John
Hi,

I've just installed the component and it looks good, thanks.

I may be missing something, but it appears the only way for a user to have private files is to have a separate category for each user? Similarly, it seems I need separate menu items referencing that category for each user for things like upload and display.

What I need is a setup where each users files can only be accessed by them (and administrators of course). I also want this set up automatically on registration.

Looking at the edocman_categories table I could easily use some code to create a new category for the user on registration and assign their user id to the user_ids field. I could also modify a generic set of menu options to point to the users own category on login and I would have what I want.

But is there an easier way?

Thanks
John

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #69497 by John
Replied by John on topic Private user files
OK, well I found the User Documents menu item and thought this solved the problem. It does allow a user to list only their documents. But it's not secure. Calling the category directly in the URL "e.g. index.php?option=com_edocman&view=category&layout=table&id=2" brings up all documents in the category. I see there is a user_ids field associated with each document, but I can't see a way of setting it so it is assigned to the user who uploads the doc. Is there an option for this?

Thanks
John

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #69507 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Private user files
Hi John

It is simple. When you create a document, you will see a field called User Ids. You can select the users you want to be able to access to that document in that fields, then only see users will be allowed to access to that document.

Please try that and let me know if you need more help

Regards,

Tuan

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #69516 by John
Replied by John on topic Private user files
Hi Tuan,

I understand that I can set permissions this way on documents I create from the backend.

But what I need is for documents uploaded by an end user through the frontend to be accessible only by that user without having to manually set permissions.

So for example, I create a category called Client Documents and give clients a menu option so they can add documents to the category. I also give them a User Documents link, which will display just the documents they uploaded. So far so good.

But even if I don't make a link to the Client Documents category available, if you call the component with the URL of the category you can see all client documents, not just the ones you uploaded.

The way around this is obviously to assign the document creator as the allowed user id for the document on a per document basis, but I need to automate this.

If there is no settable option to achieve this, can you please just give me a pointer to the code block that updates the tables after upload? It should be relatively trivial to write the user id to the document permissions post upload.

I hope this makes sense.

Regards
John

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #69654 by John
Replied by John on topic Private user files
Hi Tuan,

Any thoughts on this?

Thanks
John

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #69790 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Private user files
Hi John

Submit a support ticket sending me super admin account of your site and I will do the modification to get it works like that for you

Regards,

Tuan

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #70631 by Isaac
Replied by Isaac on topic Private user files
Hi, I have exactly the same request as the original post. Any quick way around this?

Thanks

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #70686 by John
Replied by John on topic Private user files
Hi Isaac,

Open /administrator/components/com_edocman/model/common/document.php and add the following code immediately before line 302:

if($app->isSite() && !$row->user_ids)
{
$data = JFactory::getUser()->id;
}

So now it will look like this:


if (empty($data))
{
$data = $originalDocument->image;
}
}

if($app->isSite() && !$row->user_ids)
{
$data = JFactory::getUser()->id;
}

$input->set('jform', $data);

If you want to add additional user to get access permissions, just append their user id to $data e.g.

$data = JFactory::getUser()->id . "230, 304, 199";

I note that while this works, edocman will only honour the user id security while the user exists. If you delete the user their documents are visible to everyone with access to the category.

Good luck,
John
The following user(s) said Thank You: Tuan Pham Ngoc

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #70692 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Private user files
Infact, we provided the modified code via support ticket. Maybe Isaac can upload the modified file here so that in case someone needs it, they can use it?

Tuan
The following user(s) said Thank You: Isaac

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago - 8 years 6 months ago #70694 by Isaac
Replied by Isaac on topic Private user files
Thanks John. Tuan was very helpful with this request through the support tickets. Posted below is the modified file available for download.
Please download the file document.zip and extract to administrator/components/com_edocman/model/common/ . Before extracting delete the other document.php because the document.zip contains the modified document.php. Incase of any issues, use the Support Tickets to contact Tuan Pham Ngoc and his team who are very helpful.
Attachments:
Last edit: 8 years 6 months ago by Isaac. Reason: Add file

Please Log in or Create an account to join the conversation.

Moderators: Mr. Dam