Upload documents to database & user access

Hi Everyone!

If I have a document management system with users and groups. I want to link a document to a group and the user to that group also. So when a specific user is not link to that group, I don’t want that user to have access to that specific document. Is it possible to do that and how?

Regards
Jacques

Re: Upload documents to database & user access

you need to create an associative table to do the relation between documents and groups.

so, when creating the reports or form … you can limit the using the global, ex:
select * from documents where group = [var_group]

and in the login you need to select the user group and create the variavel [var_group] with the value(s)

Re: Upload documents to database & user access

Diogo,

Can you supply me with more detail in doing this?

I am a beginner where it comes to SC and php and is in the process of learning.

Again with an example I just want to explain what I want to do.

EX: I have 2 user groups. (admin, user). When a document (test.doc) gets uploaded into the MySQL database it is linked to group - admin.
When myself login (linked to user group), I don’t have access to the document. (test.doc)

I will really appreciate your assistance.

Regards
Jacques

Re: Upload documents to database & user access

Example for your case:

Table 1(group):
cd_group
description

Table 2(user):
cd_user
login
password
fk_group(foreign key - http://en.wikipedia.org/wiki/Foreign_key)

Table 3(document):
cd_documento
name…
fk_group(foreign key - http://en.wikipedia.org/wiki/Foreign_key)

Case 1:
when registering a new user, you need to choose the group that he belongs.
Case 2:
When this user login, you must validate the login and check his group and assign to a global variable.
Case 3:
When this user is going to save a new document, the field fk_group must receive the global variable with the user group.
Case 4:
when the user is viewing the documents, you just need to limit the documents that the user group is equal to the global variable.

First of all, you need to learn relational databases and then create the application.

Re: Upload documents to database & user access

Diogo,

Can you give me a example of the code that you will use with your example?

I know understand relational database structures better.

Again, Thanks for your assistance.

Regards
Jacques

Re: Upload documents to database & user access

Searching for login at the forum, ive found this two topics:
http://www.scriptcase.net/forum_en_us/index.php?topic=2029.0
http://www.scriptcase.net/forum_en_us/index.php?topic=1383.0

Tha explain how to create the login.