Skip to content

Fix user id script fails #3383

@meericsc

Description

@meericsc

Describe the bug or behavior
Running the fix user id script with rename-user command seems to fail at fix-audit-log line. The error we get is:

Exception in thread "main" java.lang.AssertionError: Assert failed: 
{:audit-log {:time #clj-time/date-time "datexxx", :path "/api/organizations", :method "get", :apikey nil, :userid "useridxxx", :status "200"}, 
 :params [{:path "/api/organizations", :method-new "get", :userid "useridxxx", :method "get", :time #clj-time/date-time "datexxx", 
           :path-new "/api/organizations", :status "200", :apikey-new nil, :apikey nil, :userid-new "useridxxxnew", 
           :time-new #clj-time/date-time "datexxx", :status-new "200"}], 
 :result (2)}(= 1 (first result))

And if we try again it gets

Exception in thread "main" java.lang.RuntimeException: Unknown role: :logged-in

The end result is that it doesn't get to add the entitlements and roles to the new user ID and also it doesn't remove the old user ID, before it stops in error. Therefore, we end up having the old user and the new user, and the new user doesn't have any roles and any entitlements.

If we skip fix-audit-log and fix-roles, the script goes through.

Not sure if it happens also with other versions and what is the cause.

Environment
The rems version is v2.38.1-0

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGNeeds TriageA new issue that needs looking at and triage.

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions