Solved

how to distinguish private and public files(logical design question)

Posted on 2006-10-27
3
167 Views
Last Modified: 2010-03-31
Hi guys

I am creating a content management software where  admins are able to attach documents which the user would be able to see ont the website.
There are 2 types of users public and members. The admin can specify if the want everybody to see the doument or just the user. Now the problem is that
I store all the docments in one directory /attachement/documents whether private or public. The website takes care of what to show if they are logged in and what not to show.
but if they get the url of the docment such as http://xxx.com/attachemnets/docments/privatedocument.doc they would be able to open it even if they are not logged in.

Now what i need is a way to distinguish private and public documents. Would anyone have any good idea regarding this

--Thanks

0
Comment
Question by:huzefaq
3 Comments
 
LVL 1

Accepted Solution

by:
Jorge Fraser earned 200 total points
ID: 17819975
The easiest way to manage this is to store the documents in a database, that way you can mark the document at will. If this is not possible or do not want to do this, you could move the documents out of the server context and write a servlet that reads the documents and serves them to the user based on who the requestor is and what access they have.

Hope this helps.
0
 
LVL 14

Assisted Solution

by:hoomanv
hoomanv earned 300 total points
ID: 17820364
> and write a servlet that reads the documents and serves them

However you still need a way to distinguish between public and private files
Only store documents' names in database plus a flag indicating the access privilege
And access them like this
http://xyz.com/ContentManager?document=something
0
 

Author Comment

by:huzefaq
ID: 17861266
Thnak you guys for your help

But what I ended up doing was to make two different directory for public and private and made the access tot thw directory restricted in the filter.

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now