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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:23:55+00:00 2026-05-23T16:23:55+00:00

I understand how to restrict entire pages, or even components by implementing <cflogin> and

  • 0

I understand how to restrict entire pages, or even components by implementing <cflogin> and roles. For example:

<cfif IsUserInRole("Admin") OR IsUserInRole("Accounting")>
    ...You can view this page...
<cfelse>
    ...You can not view this page...    
</cfif>

But how is it recommended to restrict certain facets of a page? Say for example an “Admin” is allowed to send Global Messages to all users, but that option is not available for a regular “User”

I suppose I could use the Session to manipulate my Views (pages). How is this typically handled?

  • 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-23T16:23:55+00:00Added an answer on May 23, 2026 at 4:23 pm

    You’re right, securing a page and securing elements is different.

    In my opinion and in practice, I think tying any code to a role or user is actually the wrong approach. Instead, tie permissions to elements and pages – then tie roles to those permissions. And of course, users are assigned roles.

    It is important to have all three :

    1. Users
    2. Roles
    3. Permissions <– this is what you’re missing

    Permissions are what secure elements and pages, not roles or users Your code should have no clue (because it doesn’t need to) what users or roles there are – just names of permissions.

    When a user logs in, I grab their role(s). Then I grab all the permissions that are assigned to those roles (simply a list of string values).

    For example, on a page I might have :

    • Add item
    • View item
    • Delete item

    When I code that page, I actually secure each of those elements with permission strings named similar ( addItem, viewItem, deleteItem).

    <cfif listContainsNoCase( session.permissions, 'addItem' )>
        <!--- code to add item --->
    </cfif>
    

    (Note: I recommend using a custom tag or function for this, but for purposes of an example, the above works fine).

    If you do it this way, it provides maximum flexibility and abstraction. If you secure elements based off of roles, you limit yourself :

    • Adding new roles will require a lot of code changes!
    • Changing permissions between roles requires a lot of code changes!

    If you do it as mentioned above, you will never need to change your security code within the code base, because “addItem” permission should always be on the “add item” logic, right? 🙂

    Now if you happen to need to create a “manager” type role, that has all the user roles and a select few admin rights, you simply create that role, and assign it the correct permissions (maybe addItem and editItem, but not deleteItem). Bam! Now I have a manager role to assign to users with no code changes!

    If I had sprinkled my code with “is user this role” type of stuff – I would have to go edit my code everywhere to allow my new role “manager” – yuck!

    Make sense?

    =)

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

Sidebar

Related Questions

I understand how I can change the dns settings for my domains by editing
I understand what System.WeakReference does, but what I can't seem to grasp is a
I wonder how some video streaming sites can restrict videos to be played only
I don't understand why wcf transport layer security restrict the username/password authentication. Okay, message
How can I restrict my apk to not install on small devices, I know
I understand how JS is run and I think I understand most of the
I understand that some countries have laws regarding website accessibility. In general, what are
I understand the overall meaning of pointers and references(or at least I think i
I understand the main function of the lock key word from MSDN lock Statement
I understand that there are several ways to blend XNA and WPF within 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.