Alfresco Community Rest api,将用户添加到组

时间:2016-07-06 18:34:17

标签: alfresco

我正在使用Alfresco rest api以管理员身份创建用户。当我从表单发布数据时,它会创建用户,但不会将此用户分配给该组。

public function adduser($user, $pass, $userName, $password, $firstName, $lastName, $email, $group){
    $data = array(
        "urlPath" => "/people"
    );

    $params = array(
    "userName"  => $userName,
    "password"  => $password,
    "firstName" => $firstName,
    "lastName" => $lastName,
    "email" => $email,
    "group" => $group
    );

    return $this->callAPI($user, $pass, 'POST', $data, $params);
}

你能帮帮我吗,我在这里缺少什么?

1 个答案:

答案 0 :(得分:1)

问题是groups属性应该是一个数组,而不是一个简单的字符串。例如,以下JSON可以成功发布到/ alfresco / s / api / people:

{
  'userName': 'test6',
  'password': 'test6',
  'firstName': 'test6',
  'lastName': 'test6',
  'email': 'test6@email.vom',
  'groups': ['GROUP_ALFRESCO_ADMINISTRATORS']
}