Results 1 to 4 of 4

Thread: Object stored and used in decorator

  1. #1
    Join Date
    Apr 2012
    Posts
    4

    Default Object stored and used in decorator

    Hi, I have probably a newbie question.

    I have table USER which contains info about login, pass and autorities. Then, depending on autorites detail information about user can be found in one of following: Teacher, Student, Parent. User logs in and the information stored in USER table can be easly taken from security context. But I want to display first name and last name all the time in the header after logging - these can be fetchec from the other tables. My question is: how to handle storing one of these objects in session all the time? Or is it okay just to store User (its stored by spring) and then fetch particula table every time I need detail information?

    I use spring security 3, hibernate, jsp, sitemash.

    Thanks

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    Hello

    OK, sitemash is like TIles, Spring Security has some special tags that let you show the current user logged and some special methods within a JSP to let you show and restrict any data according the rol of the actual user logged.

    Check Spring Security Reference Documentation, that should be enough
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3
    Join Date
    Apr 2012
    Posts
    4

    Default

    Thx for the reply,

    Probably I was not clear enough. I know how to deal with logged user and restrict some content. Login details (id, pass, role) are stored in USER table and this is ok - I can fetch it and show whereever I want. The problem is that then - details about particular user (address, name, email, etc) are stored in in another table (STUDENT, TEACHER, PARENT - depending on the role in USER table). This is what I want to know on every page - for example to show his/her name.

    Greetings

  4. #4
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    Hello

    The problem is that then - details about particular user (address, name, email, etc) are stored in in another table (STUDENT, TEACHER, PARENT - depending on the role in USER table). This is what I want to know on every page - for example to show his/her name.
    Do you mean for example if the STUDENT table has for example 20 fields, you could has these cases

    1) you want show these 20 fields only if you has the ADMIN role
    2) you want show only 5 fields if you has the lowest role

    If I am correct, again Spring Security has some special tags and methods to let you show or render specifics part of the JSP file according the rol of the actual user logged, the possible problem would be you should do this control to each field in the JSP file

    If I am wrong, post some code with some details.
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •