Announcement Announcement Module
Collapse
No announcement yet.
Object stored and used in decorator Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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

      Comment


      • #4
        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.

        Comment

        Working...
        X