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

  • Home
  • SEARCH
  • 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 8852029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:18:03+00:00 2026-06-14T13:18:03+00:00

I have following table structure: Entity ——————— id | name Users ——————— id |

  • 0

I have following table structure:

Entity
---------------------
id | name

Users
---------------------
id | name | password 

UserGroups
---------------------
id | parent_id | name

Users_UserGroups
---------------------
user_id | user_group_id

Roles
---------------------
id | parent_id | name

Users_Roles
--------------------
user_id | role_id

And main objective is create Entity row level access restrictions with following conditions:

1) User creates Entity – he can see it (he is owner)
2) User group members can see it too (but if defined else – not see – it will be user private). So record can be user or group private, or public – all can see record. For example user is in sales team A and there are records what can see all group members, but there can be one or more records what can see only user – maybe potential client.
3) For example user A is in role salesman and this role is child of parent role sales managers. Then user who is sales manager role can see user A entities. Hierarchy structure of roles. Boss can see what is doing his direct employees 🙂
4) There will be profile table too, where profile can be added to role and if needed, to user too.

Main question is how to relate users/groups/roles/profiles to entity? And how to define permissions? My idea was to create column ‘user_id’ into Entity. When query Entity record, find user, after see in which role, group, profile is user and so on. But I think that it is too complex, maybe there can be much easier way, without many additional tables. I would be grateful for advice 🙂

  • 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-14T13:18:04+00:00Added an answer on June 14, 2026 at 1:18 pm

    The standard pattern is to define Principal as anything you can assign permissions to. Then user, user group and role are all examples of principal. One way to implement is to have a principal table with principal_id as it’s primary key, and then relate the user table to it via user_id, role table via role_id and group table via user_group_id.

    Then you’d have an entity_owner_principal_id column on entity, and an entity_permissions table with entity_id, principal_id. You might add columns such as “read”, “delete”, “update” to this table, or have something more flexible.

    You might also want to consider whether there is any real difference between group and role, they’re both ways of grouping users, and you appear to have hierarchy in both too.

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

Sidebar

Related Questions

I have the following table structure: ORGANIZATION_ID | Name | PARENT_ID -------------------------------------------------- 1 |
I have following table structure ID Name Parent_ID 1 abc 0 2 efg 1
I have the following table structure, which is imported into an Entity Framework project:
I have a database with the following structure: CREATE TABLE entity ( id SERIAL,
Suppose I have the following entities: @Entity @Table(name = A) public class A implements
I have following table structure: CREATE TABLE pilot_groups ( id INT PK, name VARCHAR(50),
I have the following table structure which has been imported into the Entity Framework.
I have following table structure in my DB ID Name -------------------------- ID_1 Name1 ID1
I have the following table structure: ID | fname | lname | street |
I have the following table structure inside a view which gets displayed in the

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.