プロジェクト

全般

プロフィール

Vote #79297

完了

/users API does not accept boolean-like String values for generate_password

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

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

0%

予定工数:
category_id:
32
version_id:
99
issue_org_id:
28686
author_id:
14446
assigned_to_id:
332
comments:
4
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

When creating a new user using the XML Rest API and the following XML, Redmine is not generating a new password.


    test
    test
    test
    test@example.org
    true
    true

The @true@ value for @must_change_passwd@ works as expected, the one for @generate_password@ is ignored.

The reason for that is, that @must_change_passwd@ is a proper database column and ActiveRecord will translate certain expected values to Boolean @true@. Among these are @"1"@, @"true"@, and @true@. In contrast @generate_password@ is a virtual attribute, which is not backed by a database column. Redmine has its own code to handle the translation here. But this custom code only accepts @"1"@ and @true@, i.e it's missing the @"true"@ option.

The attached patch fixes this shortcoming by using ActiveRecord's translation method directly.


journals

Please note, that since Rails 5 the way how strings are converted to booleans has changed. Previously anything but a small well known list of values was considered @true@. Now anything but a small well know list of strings is considered @false@. Consequently, with the proposed change this would also be applied to the @generate_password@ field.

I think this would be a good thing, since it's improving consistency. But I wanted to mention it anyway.
--------------------------------------------------------------------------------
Confirmed the problem. Setting target version to 4.1.0.
--------------------------------------------------------------------------------
Committed. Thank you for detecting and fixing this issue.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリREST API_32 にセット
  • 対象バージョン4.0.0_99 にセット

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

いいね!0
いいね!0