Skip to content

Bad request payload for non-anonymous user confirming the license #162

Description

@kuchtiak-ufal

Scenario:

  • as admin user create a custom license license like this:
Image (note there is no additional required user info)
  • log-in as non-anonymous user and download file from the item with custom license above
  • the License confirmation dialog contains no additional fields, except of the default ones - which is OK
  • click "I AGREE" button
  • the following request is sent to backend:
    POST server/api/core/clarinusermetadata/manage?bitstreamUUID=09818a61-1ed8-4b7c-838a-5c45573b0ad9
    and contains the payload:
[
   {"type":{"value":"clarinusermetadata"},"metadataKey":"IP","metadataValue":"172.20.0.1"}
]

(so far OK)

  • now in another window log-in as admin and update the license to contain required fields (e.g. User Name and Country)
Image - click save
  • log-in as non-anonymous user (same as before) and download file from the same item again
  • the License confirmation dialog contains User Name and Country fields, except of the default ones - which is OK
  • fill in the required fields and click "I AGREE" button
  • the following request is sent to backend:
    POST server/api/core/clarinusermetadata/manage?bitstreamUUID=09818a61-1ed8-4b7c-838a-5c45573b0ad9
    and contains the payload:
[
   {"type":{"value":"clarinusermetadata"},"metadataKey":"NAME","metadataValue":"Milan"},
   {"type":   {"value":"clarinusermetadata"},"metadataKey":"COUNTRY","metadataValue":"CZ"},
   {"type":{"value":"clarinusermetadata"},"metadataKey":"IP","metadataValue":"172.20.0.1"}
]

(so far ok)

  • now, as admin user, edit the license again, and un-check additional required fields, click save
  • log-in as non-anonymous user and download file from the same item again
  • the License confirmation dialog contains no additional fields, except of the default ones - which is OK
  • click "I AGREE" button

Now the payload is:

[
   {"type":"clarinusermetadata","metadataKey":"COUNTRY","metadataValue":"CZ"},
   {"type":"clarinusermetadata","metadataKey":"NAME","metadataValue":"Milan"},
   {"type":  {"value":"clarinusermetadata"},"metadataKey":"IP","metadataValue":"172.20.0.1"}
]

but it should be
[
{"type": {"value":"clarinusermetadata"},"metadataKey":"IP","metadataValue":"172.20.0.1"}
]

and the same invalid clarin user metadata are stored in user_metadata table which is wrong.
The

COUNTRY
NAME
IP

metadata are stored, rather than

IP

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions