Hi Guys,
I am looking at the FileResource class which inherits ContentItem and was wondering is there any reason why the dao doesn't inherit from the ContentItemDao and the service from ContentItemService? As doesn't that mean that as it stands you would require a reference to both?
Matt
Hi,
good question. I guess because the FileService was there before the ContentItem stuff.
This might require some refactorings but should work ok as it is now. Martijn wrote the TransactionalFileService and FileService whereas I was adding the FileResourceService.
In the end, there should only be two services - one for the physical files and one handling both - physical files and FileResource objects.
I'll have to look at it again but I guess you're right that FileResourceService should inherit from ContentItemService.
BTW:
I'd love to see the FileResource class implement the ISearchable interface but this is another big piece of work (especially for file types like ms-word, pdf etc.).
Regards,
Max
I've gotten it to extend the ContentItem classes pretty easily by adjusting the following class declerations and modifying a few constructors
public interface IFileResourceDao : IContentItemDao< FileResource>
public class FileResourceDao : ContentItemDao< FileResource>, IFileResourceDao
public interface IFileResourceService : IContentItemService< FileResource>
public class FileResourceService : ContentItemService< FileResource>, IFileResourceService
There may be one or two methods that aren't neceserally needed after inherting the contentitem classes, however at least inherting the relivant classes means you only need to communicate with one service.
Can you send a patch file? Then I'll see how it fits the trunk.
How do you create a patch file?
Another question about FileResource.
Say i want to have the file show up in search results. How would you prevent the results from showing if the user doing the search does not have download rights?
Matt
Patch File:
If you use TortoiseSVN for accessing the trunk - just right click the folder the code files you want to create a patch of are located and choose: Create Patch.
You receive a text file containing the differences from your local version to the current version of the repository (trunk in this case).
File Rights:
Actually the search result should not link the file directly. Or the search module has to be improved to handle the permissions of the file and show/hide the link accordingly.
mgaerberActually the search result should not link the file directly. Or the search module has to be improved to handle the permissions of the file and show/hide the link accordingly.
Would it not make sence to use the ContentItemPrivileges for this? (The view privielege is technically the same as the download privilege)
The ContentItem class has a collection of permissions:
protected IList<ContentItemPermission>contentItemPermissions;
ContentItemPermission is derived from Permission which defines view and edit rights.
In FileResource, there is another collection - DownloadRoles which defines the allowed roles for getting the content.
I think being allowed to "view" or "download" something are different things. Having view privilege for a file allows me to find it and see it's meta data (name, description etc.)
@Martijn: Couldn't we add a DownloadAllowed property to the Permission class? The we would have everything handled there.