If your users can be grouped, put the files is directories by group, outside of the
docs directory. Then you can display by directory. Your directory structure might look
something like this:
/data
|_ /user1docs
| |_ /... documents
|
|_ /user2docs
| |_/... documents
|
|_ /..etc
the servlet can check the userid, determine the base directory for that users docs,
and serve up a list of links based on the docs in that directory. Building the list on
the fly allows you to add or remove documents without having to recode. When the user
selects a link, a different servlet uses the link to fetch the document.
I use this multi-servlet approach all the time. Make sure you verify the userid/base
directory in every servlet. Otherwise an intelligent user could manually enter a
servlet call and access documents they shouldn't.
If your users can not be grouped, then I would use a lookup table. A servlet would
check the userid and create the list according to the lookup table. A second servlet
would actually serve the document, again checking the lookup table to thwart hack
attempts.
Ed.
Jaime Santana wrote:
> Hi everybody !
>
> I am trying to figure out how to give file access to users. This is what I have
>to do, I will have like 100 html files, but what files are accesible to the users,
>depends on what user wants to use them. 100 html documentes is to much to show to a
>user if this user doesn�t have access to all of them, so what I�m plannig to do, is
>to ask for an user ( and a password ) and depending on this user, I will show the
>links to the documents this user has access to,
>
> but how do I restrict the acces to the rest of the files for this user?
> ( a same file can be used by serveral users,nin other words, a document can be seen
>by many users ).
>
> Thanks in advance !
> I appreciate you help
>
> Jaime Santana
> Sachs Boge S.A. de C.V.
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html