Checkbox Forums

Help
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    PeterB is offline Junior Member
    Join Date
    Jan 2009
    Posts
    6

    Cool Strange behaviour when adding users to Groups

    As per my previous post, I successfully used the Direct API to add a network (AD) user to Checkbox. However, I then tried to add to add the user to a Checkbox group and save the group and received the following error:

    "Unable to save data".

    The code is basically:

    ---
    Group group = Group.GetGroup("Group1");
    group.AddUser("User1");
    group.Save();
    ---

    So I switched back to the Web Services API just for group management and while there was no error, the user wasn't being added to the group.

    The code was:

    ---
    _userManagementProxy.AddUserToGroup(_contextToken. Value,
    "User1", role.DatabaseId);
    ---

    So then I adjusted to User Name to be:

    "DOMAIN/User1" [Note the forward slash which I thought strange, but guessed it from how it's displayed in the Checkbox UI].

    This then worked, which is great. So I'll probably stick to this hybrid method until the new version.

  2. #2
    pwiesner is offline Administrator
    Join Date
    Mar 2007
    Posts
    385

    Default

    I am not sure why an exception was thrown. I will take a look in the morning when I get in.

    As you have discovered, user management methods expect a user's unique identifier not their username. In the case of a network user the unique identifier is domain/username. When creating a user their unique identifier should be the return value. If you are unsure of a users unique identifier you can look it up in the ckbx_Credential table.

    A unique identifier is used rather than username so that a Checkbox user and a network user can have the same name.

  3. #3
    PeterB is offline Junior Member
    Join Date
    Jan 2009
    Posts
    6

    Default

    Thanks - the Direct API probably failed because I didn't use the unique domain/username token as the username, so it may have failed to save the group as the user didn't exist.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.0