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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:17:38+00:00 2026-05-11T08:17:38+00:00

The App I need to implement a web app that will be used by

  • 0

The App

I need to implement a web app that will be used by different users. Each user has different privileges on various tables, e.g.

  • User A can see fields ‘name’ and ‘address’ from the table Student
  • User B can see fields ‘name’ and ‘phone number’, but not ‘address’ from the table Student
  • User C can see and modify all fields mentioned above
  • I will have something at the UI level to limit certain access, e.g. hide the ‘edit’ button for users that don’t have permission to modify entries. However, I think I should have something at a lower level (at a database level maybe?) just to ensure data security.


    The Problem

    I am using Hibernate, JBoss, DB2 and Struts for my app. I think I should use a JBoss LoginModule of some sort, which authenticates the user against a database with user/password/roles (but I may be wrong(?)). I have done some research and came up with the following options, but none seems to fit my case. I would think this is a very common data access problem in multi-user web apps. Could somebody please point me to the right direction? Thank you in advance!

    1. Use the ‘grant’ tag in hibernate.cfg.xml with JACC event listeners. This can set ‘insert’ ‘update’ ‘read’ permissions on all hibernate entities. However, what if I need finer controls? I need to set permissions on certain fields instead of the entire object. http://www.hibernate.org/hib_docs/v3/reference/en-US/html/objectstate-decl-security.html

    2. Limit permissions on getter/setter method of each ejb. If I understood this correctly, this requires manual configuration of every single bean for every user profile, which seems unrealistic for me. EJB Method Permissions

    3. Code the DAO’s to check for user permissions. Roll my own utility function that checks a giant permission table everytime a particular DAO method is called to determine if the logged in user can perform the action or not.

    4. Use ‘interceptor’ and ‘events’ in Hibernate. Define specific ‘onLoad’, ‘onSaveorUpdate’ etc. events and interceptors for each class. Can I specify permission level for individual fields in this case? http://www.hibernate.org/hib_docs/v3/reference/en-US/html/objectstate-events.html

    I might be barking at the wrong tree. All of the above seem to be labour-intensive and not very intelligent. None of the above options give me programmatic ways to change user permissions at runtime, which would be useful when an admin-level user want to give another user more control in this app.

    What is a good way of doing data-access control here?

    • 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. 2026-05-11T08:17:38+00:00Added an answer on May 11, 2026 at 8:17 am
      1. Add a security key to your entities, create a table for permissions and link user with permission with entitytype and also with security key with role. This way you can say things like: Admin_role can access Student (Entitiy type) and do read (Operation in Permission) and Write (Operation) while Student_role can access Student_key for him-/herself and Read_permission. You can fix the address by refactoring that into an entity and adding a security key to it.

        1. Your number four could have a closed-world assumption and say that unless you can for the current role of the user, link the property-name with a flag in a dictionary (entity+property)-hash to flag, the closed world-assumption being that reads are not allowed by default. Then of course you don’t get any writes-permissions etc.

        2. You can define views in your database and assign rights to them using the database authentication system. This is probably the most clean way if you are able to code yourself, the way of selecting which view to call depending on which role we are. (My former RDBMS-teacher would love me for saying this ;)) This also goes away a bit from Hibernate and couples your stuff more to the database. It depends on how movable/portable your code needs to be, I guess.

        3. Use an aspect around your generic dao (IRepository) which rewrites the queries based on your permissions; this implies you have the permission-based security in code of course.

      The edit-button hiding in the gui can really only be done if you first port the permissions to code, like in my point 1. I suggest you have a look at Ayendes blog for an open-source implementation of this, he’s a very skilled coder.

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

    Sidebar

    Ask A Question

    Stats

    • Questions 156k
    • Answers 156k
    • Best Answers 0
    • User 1
    • Popular
    • Answers
    • Editorial Team

      How to approach applying for a job at a company ...

      • 7 Answers
    • Editorial Team

      How to handle personal stress caused by utterly incompetent and ...

      • 5 Answers
    • Editorial Team

      What is a programmer’s life like?

      • 5 Answers
    • Editorial Team
      Editorial Team added an answer Before you read this, read Greg's answer about hashing. Then:… May 12, 2026 at 10:54 am
    • Editorial Team
      Editorial Team added an answer Don't? It's like a thread only with very little CRT… May 12, 2026 at 10:54 am
    • Editorial Team
      Editorial Team added an answer The only way to know for sure is to benchmark… May 12, 2026 at 10:54 am

    Related Questions

    I am designing a web app that has some information that needs to be
    I have made a web app where I am using a module which redirects
    In my web app I use several asmx (Web Services) from the same provider,
    I am looking at the best approach to add rich functionality to an existing

    Trending Tags

    analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

    Top Members

    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.