Changeset 196

Show
Ignore:
Timestamp:
01/26/09 14:50:25 (10 months ago)
Author:
gallardj
Message:

Fixes #2931. If a user hasn't logged into elgg, they won't have a elgg_user yet. These changes add a 'blank' user entry into the db to allow a project profile to be created for them. We can assume that all of their proper info will be filled in from SSO if they ever choose to log into elgg.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • management/bs-admin/trunk/cache_and_sync.py

    r188 r196  
    252252      cursor.execute(sql) 
    253253      conn.commit() 
     254    else: 
     255      sql = "INSERT INTO elgg_users (username, active, owner, user_type, moderation) VALUES ('%s', 'yes', '-1', 'person', 'no')" % (p.owner.username) 
     256      cursor.execute(sql) 
     257      conn.commit() 
     258       
     259      sql = "SELECT ident FROM elgg_users WHERE username='%s'" % (p.owner.username) 
     260      cursor.execute(sql) 
     261      value = cursor.fetchall() # returns a list of tuples 
     262      if value: 
     263        ownerid = value[0][0] # we only need the first record in the first tuple 
     264        sql = "INSERT INTO elgg_users (username, name, active, owner, user_type, moderation) VALUES ('%s', '%s', 'yes', '%s', 'project', 'no')" % (each, p.name, ownerid) 
     265        cursor.execute(sql) 
     266        conn.commit() 
     267 
    254268  # end of new profile sync 
    255269