【问题标题】:Alfresco Community Rest api, add user to groupAlfresco Community Rest api,将用户添加到组
【发布时间】:2016-11-08 22:29:51
【问题描述】:

我正在使用 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);
}

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

【问题讨论】:

  • 这完全是基于我的预感和以前的经验,但是那个群体存在吗?您是否发送带有“GROUP_”前缀的组名?
  • $_POST = [ 'AdduserModel' => [ 'userName' => 'test5', 'password' => 'test5', 'firstName' => 'test5', 'lastName' => 'test5', 'email' => 'test5@email.vom', 'groups' => 'GROUP_Testgroup', ], ];

标签: alfresco


【解决方案1】:

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

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

【讨论】:

  • 嗨,杰夫,我收到了这篇文章,但仍然无法添加用户 $_POST = [ 'AdduserModel' => [ 'userName' => 'test1', 'password' => 'test1', ' firstName' => 'test1', 'lastName' => 'test1', 'email' => 'test1@hotmail.com', 'groups' => [ 'GROUP_Name', ], ], ];
  • 您可以尝试使用 curl 或 postman 之类的工具将 JSON 发布到端点吗?如果这有效,那么您就会知道您的问题与语法有关。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-10-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多