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 7171537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:26:02+00:00 2026-05-28T15:26:02+00:00

I have DB with few permission tables in form: UserId, Object Id, lot of

  • 0

I have DB with few permission tables in form:

UserId, Object Id, lot of bit fields

I’ve added users groups to my DB and I need to update permissions to work with users and users groups. I think about 2 approaches.

  1. Create copy of each permission table and have 2 tables for each object permission (user and group permission) – in each table I’ll have one foreign key to ‘permission owner’ tables (in one table – to users and in second table to user groups):

    UserId NOT NULL, Object Id NOT NULL, lot of bit fields  
    GroupId NOT NULL, Object Id NOT NULL, lot of bit fields
    
  2. Add one field (GroupId) to each permission table and use one of fields (UserId or GroupId) to identify if it is permission for group or user. So I’ll have table with 2 foreign keys – to users and user groups, but for each record only one of those FK will be used – other will be null.
    Table could looks like this:

    UserId NULL, GroupId NULL, ObjectId NOT NULL, lot of bit fields
    

What is the best solution in your opinion? What are pros and cons of both? Are there other, better solution?
EDIT: I need to know what to do with foreign keys to users and groups, not with bit fields.

  • 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-05-28T15:26:03+00:00Added an answer on May 28, 2026 at 3:26 pm

    If the types of permissions that both sets can be granted are always the same, I’d probably keep it in the same table. But make sure you add a check constraint:

    UserId int NULL,
    GroupId int NULL,
    constraint CK_CorrectFKs CHECK (
       (UserId is null and GroupId is not null) or
       (UserId is not null and GroupId is null)
    ),
    ObjectId int NOT NULL, lot of bit fields
    

    Or, have you considered modelling groups as users – either just modifying the Users table to accept groups directly, or having the Groups table (with “group only” columns) referencing the Users table? It may be a simpler route to go down (depending on which other parts of your database need to only work with users, for example). Then all your permission checks can just be “Here’s a list of IDs (one of which is the user, the other are groups), please work out the aggregate permissions for this user”.

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

Sidebar

Related Questions

Currently I have tables like: Pages, Groups, GroupPage, Users, UserGroup . With pickled sets
I have table with permissions that has few bit fields. I want to group
I have a few questions about Core Location. 1) Should the user refuse permission
i have few confusion regarding ORM(Object Relational Mapping) i am thinking about to use
I have few controls (Label, Custom Textbox, Datagridview) docked on a form. When I
I have few text fields like SSN , phone number and email id. I
My Facebook application has a few thousand users but they have not visited the
We have a web application where we need to create functionality to manage users,
I have a Facebook app, and have asked for user_checkin permission when my users
I have lot of stored procedures used across different clients, for few clients there

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.