Fork me on GitHub

Syncing data with an external database  Bottom

  • Tricky question here....

    We are launching a new "community" site for our organization. It is aimed at a specific sub-group of our membership, and we want each member of that subgroup to have special permissions when they log in to the community site. Membership to this group changes continually and that membership data is stored in a database external to Zikula. We are using OpenID as a signon, so a given user in Zikula can be matched to a member record in the external database.

    I don't think it will be a big issue to write some code that will find the current membership status of a given user and make sure that the user belongs to a specific permission group in Zikula. The question is where to put the code. My first thought would be to write a theme plugin and put it into the "logging you in" page that a user is passed to when they log in. But what if they check the "remember me" box and don't log in (again) for months? I don't really want to hack User module code if I don't have to. I guess this is a question for the architects that know Zikula inside and out. Any great places for this?

    Related issue: in writing the code that gets the external database info, I need it to be cross database since it is currently in mssql but will soon be in mysql. I usually use adodb for that. Would there be any issues with using the adodb libs already packaged with Zikula or should I upload a separate copy of it?
  • Quote

    But what if they check the "remember me" box and don't log in (again) for months?

    Just set the security to high and define an appropriate session timeout ...

    Quote

    Would there be any issues with using the adodb libs already packaged with Zikula or should I upload a separate copy of it?

    You can use the adodb packaged with Zikula. Even better, you can use the DBUtil library to do this as config.php now contains parameters which let you define multiple databases to work with ...

    Greetings
    R
  • rgasch

    Quote

    But what if they check the "remember me" box and don't log in (again) for months?

    Just set the security to high and define an appropriate session timeout ...


    I realized last night that this won't work with OpenID since that "logging you in" page gets skipped because it's going out to another site for the password. Any other suggestions?
  • Yes, alter the OpenID login code to check for your group membership. That would seem like the simplest solution.

    Greetings
    R
  • rgasch




    Quote

    Would there be any issues with using the adodb libs already packaged with Zikula or should I upload a separate copy of it?

    You can use the adodb packaged with Zikula. Even better, you can use the DBUtil library to do this as config.php now contains parameters which let you define multiple databases to work with ..
    Greetings
    R


    Thanks Robert, I'm just getting back to this...

    I see how to configure a 2nd database in config.php, but how do you actually use it? I've looked through the dbutil docs in the Wiki and don't see it addressed, I've looked at the functions, expecting to see a parameter for which DB config to use, and don't see it. An example in config.php would be very helpful I think. This is for performing a query on an external database not under management of any particular module.

    Thanks.

This list is based on users active over the last 60 minutes.