logo       
Google Custom Search
    AddThis Social Bookmark Button

RE: user id's: msg#00022

Subject: RE: user id's
> From: liveuser-bounces-jG1DcbwcvVYUuug7z7PF4w@xxxxxxxxxxxxxxxx 
> [mailto:liveuser-
> bounces-jG1DcbwcvVYUuug7z7PF4w@xxxxxxxxxxxxxxxx] On Behalf Of Lukas Smith
> 
> > From: liveuser-bounces-jG1DcbwcvVYUuug7z7PF4w@xxxxxxxxxxxxxxxx 
> > [mailto:liveuser-
> > bounces-jG1DcbwcvVYUuug7z7PF4w@xxxxxxxxxxxxxxxx] On Behalf Of LIMBOURG 
> > Arnaud
> >
> > > The admin class was already using a sequence, we just moved
> > > the call to a
> > > private method. It happens when a user is added to the Perm
> > > container. Atm
> > > there is no way to specify the user_id, i could be added as
> > > an optional
> > > parameter and used if present, fallback to sequences if not ?
> >
> > As a follow-up to what i said, i just checked lukas commit (really
> this
> > time). The authId as a sequence should be optional indeed. I'm using
> it
> > with
> > md5 hash atm. The reason i do this is that i currently have two
> separate
> > DB
> > with user accounts, i'm switching to liveuser and int mid-term i'd
> like to
> > have one palce which contains the user accounts.
> >
> > Having md5 on both sides is almost a guarantee that no two id match
so
> i
> > can
> > add a SOAP container (or whatever-remote) and move all the user
> accounts
> > in
> > one place without having to do any major DB update.
> >
> > If we use sequences that'll mean i'll have to identical ids in each
DB
> > matching a different user. Whereas the perm_users table would be the
> only
> > one to update in case i can go the way i want to.
> 
> Ok for now you should be fine using the "auth_container_name" field.
> Other than that I would simply initialize the sequences so that one
> starts at a higher range. But yes I agree we should make it possible
to
> pass the exact id to use as I stated in my mail to Markus.

Ok.

The new addUser() in DB_Common.php would then look like this:
    /**
     * Add a user
     *
     * @access  public
     * @param   string   $authId    Auth user ID of the user that should
be added.
     * @param   int      $type      User type (constants defined in
Perm/Common.php) (optional).
     * @param   mixed    $permId    If specificed no new ID will be
automatically generated instead
     * @return mixed   string (user_id) or DB Error object
     */
    function addUser($authId, $type = LIVEUSER_USER_TYPE_ID, $permId =
null)
    {
        if (!$this->init_ok) {
            return false;
        }

        if (!$permId) {
            $permId = $this->dbc->nextId($this->prefix . 'perm_users');
        }

        $query = '
            INSERT INTO
                ' . $this->prefix . 'perm_users
                (user_id, auth_user_id, type, auth_container_name)
            VALUES
                (
                ' . $permId . ',
                ' . $this->dbc->quote($authId) . ',
                ' . $type . ',
                ' . $this->dbc->quote('DB_Medium') . '
                )';

        $result = $this->dbc->query($query);

        if (DB::isError($result)) {
            return $result;
        }

        return $permId;
    }

I would change the code in the auth container accordingly.

Regards,
Lukas



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>