Announcement Announcement Module
No announcement yet.
Dynamic Paths/Roles question Page Title Module
Move Remove Collapse
This topic is closed
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic Paths/Roles question

    One of the requirements of the site I am working on is dynamic security roles, for instance new companies may be added that require new url paths ect. I went ahead and built a custom ObjectDefinitionSource to pull these roles from a database instead of the xml file, and that works all well and good.

    But the problem is if I change a value in the database, I have to restart the server for the changes to take affect. Is there any way for me to force acegi to look at the database for every user login (there shouldnt be all that many at a time) rather than caching these paths and roles from the start?

  • #2
    The issue is that the ObjectDefinitionSource isn't only used for a login but for every request you process. So quering the database everytime a request comes could become a performance drain...

    Easier would be to implement caching and refresh the configuration at specified intervals. Also letting the application with which you edit (force) refresh the configuration would be a solution.


    • #3
      Hmm, I like the second option alot better. That sounds like the solution I am looking for except, I am not sure how to refresh it codewise. Could anyone point me in the right direction?


      • #4
        I am really interested in finding the solution to this one too. Is it possible to force a refresh of all credentials from the db?


        • #5
          I don't suppose anyone has had any luck with this question?


          • #6
            Couldn't you just declare your ObjectDefinitionSource as a bean in the spring config file, and implement a "reloadRolesFromDb" method in your custom ObjectDefinitionSource, and inject this object into the spring filter as you normally would.

            You can easily just retrieve your bean from the spring context and call this method whenever you add a role.

            Am i missing something?


            • #7
              Couldn't you simply update the objectDefinitionSource at the same time as updating the database?
              Last edited by karldmoore; Aug 29th, 2007, 11:47 AM.