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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:02:27+00:00 2026-05-13T11:02:27+00:00

The application in question is a fairly extensive with many different types of access

  • 0

The application in question is a fairly extensive with many different types of access roles (read Customer Service, HR, Admins, etc etc). Tiered access, so each role inherits the access below it, so HR has Read Only, CS has edit abilities, Admins full control. Menu bars and buttons enable/visible attributes are controlled by an outside an outside library that handles all role-based access via reflection. The man who wrote this was an evil genius.

That being said, I’d like eventually to remove it. The knowledge base on how it works left with him years ago, and development on this application is starting to stagnate since the documentation on the security ‘suite’ is awful. Everything is stored within a database, down to label visibility for each label. It’s a bit overboard and not refactor-friendly.

I’ve spent a solid amount of time looking into windows forms security. We’re running our own user/roles for this app rather than Active Directory. I’d like to use User/Principal, since that looks like the best option. If there’s another option, I’m open to advice, I’d like to see this done the right way since we’re considering a full rewrite (unrelated to this).

All the searching I’ve done through MSDN and other websites has led me to believe that I can only control flow through methods and classes based on roles, not as granular as “enable this button” or “hide this menu bar.”

Is there a better way than doing something along the lines of:

btnA.Visible = Thread.CurrentPrincipal.IsInRole("HR");  
btnA.Enabled = Thread.CurrentPrincipal.IsInRole("CS") ||  
    Thread.CurrentPrincipal.IsInRole("ADMIN");

Is there a better way in general? What’s the best way to handle this?

  • 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-13T11:02:27+00:00Added an answer on May 13, 2026 at 11:02 am

    That’s pretty close to the way that we do it, both in WinForms and in our ASP.net applications. The one difference is that we store the role names in a database so that they are easier to maintain and upgrade than hardcoded constants.

    While it lacks the sexiness of some sort of automatic binding (which it seems that you are looking for), it’s solid and has not been troublesome to deal with. However, our application does not have a tremendous variation between users. For the most part, if a user can get access to part of the application they can perform most of the actions.

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

Sidebar

Related Questions

Quick question, hopefully... I'm building an application with a fairly extensive log file. I'd
Question: Should I write my application to directly access a database Image Repository or
Question I have an application written in Java. It is designed to run on
This question is for a web application. And maybe it's a stupid question but
Simple question: Can I mix in my desktop application Java and JavaFX Script code?
I have a question about how to deploy WPF application into a PC without
I have some question: How to make a role based web application? Such as
I got a quick question about running a directX application (C++) in a managed
A similar question was already asked ( Performing a Stress Test on Web Application?
I have a question regarding handling errors in a J2EE application. Our current application

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.