• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Storing pages a user can access

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to restrict users to specific pages after they properly login.
What would be the best method for storing the pages?

Should I store all the pages the user has access to in a session ArrayList variable and then check each page to see if a match is found in the list using a filter?

Thanks,
Dave
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you talking about storing the pages themselves? (If so, why?)

Or are you asking about a mechanism to determine who has access to what?
 
Dave Bosky
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was asking about a mechanism to determine who has access to which pages and method would be best to accomplish this task. Sorry for the ill formatted question...

Thanks,
Dave
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One way to handle this could be to assign each user a role. Each page requires certain roles in order to be accessed. For example, admin pages require users to have the "ADMININSTRATOR" role.

There are lots of ways to keep track of which roles each page requires. One of the simplest might be a Map in the application context that uses the URI of the page as a key to a list of required roles (or a single role if your layout is that simple). This could be loaded by a context listener at app startup, perhaps from a properties file or an XML file.

If a role-based approach isn't appropriate, then there may be other ways. More info on how your app operates and is organized would be necessary.
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic