This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Problem with session information

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have an app using servlets. The problem is I let a user log in to make changes to the information or update/add a new record to the database. I read her user id and give her supervisor control. So lets say she is in there making changes. Ok another person logs in (not a supervisor) to view records (not necessarily the same record). Well when the first person (supervisor) goes to save the record it won't let her because it has the permissions of the last person logged in who doesn't have the right to change records. How can I stop this? Is there something in the session attributes causing this? I print out who is logged in at the moment she goes to save and it shows the supervisor's name but won't let her save. Any ideas? Thanks
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

because it has the permissions of the last person logged in



What is "it".

Are you managing user rights at the context (application) level?
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds more like a thread safety problem caused by instance variables.

Gary, do you have any instance variables in your servlet?
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may be problem with thread issues.I think you are using local variable for user name and instance variable for the user authorizations (right to change).Instance variables are not thread safe.Use local variable instead.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!