プロジェクト

全般

プロフィール

Vote #81664

未完了

REST group api does not work when user is already member of group

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
REST API_32
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
32
version_id:
0
issue_org_id:
35965
author_id:
64977
assigned_to_id:
0
comments:
0
status_id:
1
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
159
ステータス-->[New]

説明

This might be related to:
https://stackoverflow.com/questions/56767239/how-to-fix-user-is-invalid-error-when-adding-user-to-a-group-with-redmine-api

How to reproduce:

add a user U1 to group G1 via the redmine admin panel

add the same user U1 to the group G1 with a (curl) api request

the following errors are thrown:


$ curl -i -H "Content-Type: application/json" -X POST --data '{"user_id":1234}' -H  "X-Redmine-API-Key: secret" https://myredmi.ne/groups/1/users.json

HTTP/1.1 422 Unprocessable Entity
Date: Fri, 08 Oct 2021 09:13:04 GMT
Server: Apache
Cache-Control: no-cache
Referrer-Policy: strict-origin-when-cross-origin
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
X-Request-Id: 5b6c0feb-2051-41b0-bb27-5227f558d708
X-Download-Options: noopen
X-Runtime: 0.007623
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-Powered-By: Phusion Passenger 5.0.30
Strict-Transport-Security: max-age=31536000; includeSubDomains
Status: 422 Unprocessable Entity
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8

{"errors":["User is invalid"]}

the user is not invalid, but already part of the group.

--

i would prefer a behaviour where the user is added the group again,
as in the background this invokes other operations,
namely on members and member_roles.

more precise:

  • a group G1 has access to project P1
  • when a user U1 gets added to the group G1, in the background this user gets added project P1 (inherited from G1)
  • when the user is removed from G1, it is also removed from P1 (as found through inherited)

i have noticed that sometimes, (not often,) this process does not complete,
so users might get added to a group, but not to the projects of the group,
adding them again to the group should fix the problem,
but the api does not allow that,
if the api would allow that, then this would possible 'self-heal' the rare cases in which the users where not added to projects properly

--

workaround: first remove group, and add again; for example

(ps: delete seems only to work with xml)

hth

Admin Redmine さんが約2年前に更新

  • カテゴリREST API_32 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0