Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

how to set user prefs on first login

ArnYArnY New
edited July 2006 in Vanilla 1.0 Help
Hello, I'm working on Vanilla, trying to integrate it nicely with our ldap servers. Right now, my vanilla check the user's credentials on the ldap servers and if they are valid a user is created in vanilla's database. On the first login the firstname, lastname, email value are fetched from the ldap and added in the user account. It works fairly well. I need vanilla to be aware of some other informations that are available in the ldap server, like the type of the user (student, teacher) their location, etc. I know how to add new values in the userprefs from an extension but i doubt that can fit: the values needs to be set on the user's first login. Do you have any ideas on how to do this? Thanks

Comments

  • I think I saw a similar discussion earlier this week, have a look here: http://lussumo.com/community/discussion/2630/extension-idea-ldap-lookup/ http://lussumo.com/community/discussion/894/using-ldap-authentication-for-vanilla-users/
  • that's not exactly related.. the ldap part is actually done.. my problem is more about initializing custom user prefs when creating the user.
  • lechlech
    edited July 2006
    Ok, I must have slightly misunderstood the nature of the question as I was waking up when first reading. Let me see if I understand this a little better: You want to import existing user data or do you want to maintain user data through vanilla? Because there's nothing at the moment which would prevent a user from changing their details from within Vanilla's over-writing what you set for them. Unless of course you don't mind that.

    The data you probably want is stored in an indexed array within the database, if you've already checked it out you might already know that. Depending on the data you want to pull from your ldap servers you could probably craft an extension which gives a user the option to do this for themselves rather than doing it for them from the start, but that's entirely up to you right now. I'll just attempt to get you started before Mark or anyone else has better suggestions.

    If you've noticed, users can already add their own additional details and there doesn't appear to be any limit which is by default stored under LUM_User. The key you probably want to manipulate (with great care) is the Attributes column, this is what stores all the juicy "extra" random details outside of the other defaults. This is probably the best place to pull those details in safely without risking the integrity of the account.

    it looks something like this when broken down to something more readable:
    a:4:{ i:0;a:2:{s:5:"Label";s:1:"a";s:5:"Value";s:28:"pair A is 28 characters long";} i:1;a:2:{s:5:"Label";s:1:"b";s:5:"Value";s:6:"pair B";} i:2;a:2:{s:5:"Label";s:1:"c";s:5:"Value";s:6:"pair C";} i:3;a:2:{s:5:"Label";s:1:"d";s:5:"Value";s:6:"pair D";} }

    it's fairly self explanatory, the key has 4 attributes (denoting a:4:) and the index starts at 0 (i:0;a:2:) and expresses a pair (i:0;a:2:) consisting of 4 values (label/item & value/item). Both "label" and "item" are only used internally to my knowledge to build the query and should not be changed. the preceeding "s:###" is a character count for each value/pair within that string. Giving it a total max length at the moment of 200 characters, I'm not sure if anything beyond that range is considered invalid but it's best to stay under that.

    If a user within vanilla decides to delete data, for example something which was in index 2 (i:2;a:2; aka the 3rd item), the entire array would get numericly reindexed and it's attribute count would change from a:4: to a:3: to reflect that change. And it's indexes would shift and read from 0 to 2 respectivly within that array. Hope that helps.
This discussion has been closed.