Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8531727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:33:11+00:00 2026-06-11T09:33:11+00:00

I have a simple document management system which currently offers public access to documents

  • 0

I have a simple document management system which currently offers “public” access to documents based on a company id – I would like to implement access controls on a user by user basis. I am happy with how to check access rights etc in PHP but not sure how best to maintain approved users in the table in an efficient way.

A document could have public access or private access restricted to x users and as I don’t know the value of x it doesn’t make sense to implement multiple fields in MySql called user1, user2 etc.

There is a table already called users and one called documents. Would a new table called users to docs make sense or is there a better way to implement this so I can check if a user is entitled to access the document if they attempt to?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:33:12+00:00Added an answer on June 11, 2026 at 9:33 am

    Best method is to have link tables, e.g.

    table #1: users (id, ...)
    table #2: documents (id, ....)
    

    and

    table #3: user_documents (user_id, document_id)
    

    where user_id and document_id are foreign keys pointing at the users and documents tables

    If a record exists in user_documents, then the user has access to the document. If you need to implement various levels of access (read/write/etc..) you’d store that in the user_documents table as well in extra fields.

    By comparison, if you had something like

    table #1: users (id, doc1, doc2, doc3, etc...)
    

    where the doc# fields point at documents this user has access to, you’d have to have N fields in the table to handle permissions for N documents. If only a few users have rights on N docs and most have far fewer, you’d be wasting a lot of space on unused fields. And there will always be some joker who requires N+1 documents, meaning you’re modifying your tables every time.

    With the link table, you only have 2 fields, ever, and only as many records as there are user/document access pairs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

let's say I have a simple javascript like so: $(document).ready(function(){ if(login == 1) {
simple thing which I need to do is, that I have a pdf document
Basic problem I have some large, but logically organised documents - and would like
I'm writing a simple document management system for my work. I'm only a hobbyist
I have a simple Document based Core Data app (built around the standard Apple
I have a simple document-based Cocoa app that acts as a viewer for .wav
I have a simple xml document that looks like the following snippet. I need
I have a simple structured document like this: people : [ { id :
I am planning to build a simple document management system. Preferably built around the
I'm searching for a free and open source document/content management system (web-based) to implement

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.