ufal / clarin-dspace

clarin-dspace digital repository based on DSpace and LINDAT/CLARIN DSpace
http://lindat.cz
BSD 3-Clause "New" or "Revised" License
27 stars 18 forks source link

Strange behavior of licenses - user_metadata #1100

Closed kosarko closed 1 month ago

kosarko commented 10 months ago

Originally in v5, if I've filled in user metadata for license:

https://github.com/ufal/clarin-dspace/assets/1842385/fa7c0338-09c7-4aa9-a45a-2ff12fce2b9a

the transaction linked only to the current metadata, i.e. the above video resulted in:

dspace5l_licenses=# select * from license_resource_mapping join license_resource_user_allowance USING(mapping_id) join user_metadata USING(transaction_id) where license_id = 22 and created_on >= '2024-01-18';
 transaction_id | mapping_id | bitstream_id | license_id | active | eperson_id |         created_on         |              token               | user_metadata_id | eperson_id | metadata_key |       metadata_value
----------------+------------+--------------+------------+--------+------------+----------------------------+----------------------------------+------------------+------------+--------------+-----------------------------
           8077 |       1285 |          774 |         22 | t      |        880 | 2024-01-18 16:44:40.904457 | xxx_some_token_xxx |            31008 |        880 | COUNTRY      | CR
           8077 |       1285 |          774 |         22 | t      |        880 | 2024-01-18 16:44:40.904457 | xxx_some_token_xxx |            31009 |        880 | EXTRA_EMAIL  | redacted_email@example.com
           8077 |       1285 |          774 |         22 | t      |        880 | 2024-01-18 16:44:40.904457 | xxx_some_token_xxx |            31010 |        880 | ADDRESS      | Nekde v Praze
           8077 |       1285 |          774 |         22 | t      |        880 | 2024-01-18 16:44:40.904457 | xxx_some_token_xxx |            31011 |        880 | NAME         | Franta BU
           8077 |       1285 |          774 |         22 | t      |        880 | 2024-01-18 16:44:40.904457 | xxx_some_token_xxx |            31012 |        880 | IP           | 10.10.1.83 

While in v7, a similar task:

https://github.com/ufal/clarin-dspace/assets/1842385/2fe998e3-5ad9-4823-8003-2d2f077a4447

Stores much more values (probably from history)

select count(*) from license_resource_mapping join license_resource_user_allowance USING(mapping_id) join user_metadata USING(transaction_id) where license_id = 78 and created_on >= '2024-01-18 16:19';
 count
-------
   122
(1 row)

dspace=# select count(*) from license_resource_mapping join license_resource_user_allowance USING(mapping_id) join user_metadata USING(transaction_id) where license_id = 78 and created_on >= '2024-01-18 16:19' and metadata_key = 'NAME';
 count
-------
     6
(1 row)

select metadata_key, metadata_value, created_on from license_resource_mapping join license_resource_user_allowance USING(mapping_id) join user_metadata USING(transaction_id) where license_id = 78 and created_on >= '2024-01-18 16:19' and metadata_key = 'NAME';
 metadata_key | metadata_value |       created_on
--------------+----------------+-------------------------
 NAME         | filatko        | 2024-01-18 16:19:58.511
 NAME         | filatko        | 2024-01-18 16:19:58.511
 NAME         | test           | 2024-01-18 16:19:58.511
 NAME         | test           | 2024-01-18 16:19:58.511
 NAME         | No ORG, WTF    | 2024-01-18 16:19:58.511
 NAME         | TEST USER NAME | 2024-01-18 16:19:58.511
(6 rows)

dspace=# select metadata_key, metadata_value, created_on from license_resource_mapping join license_resource_user_allowance USING(mapping_id) join user_metadata USING(transaction_id) where license_id = 78 and created_on >= '2024-01-18 16:19' and metadata_key = 'INTENDED_USE';
 metadata_key | metadata_value |       created_on
--------------+----------------+-------------------------
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
 INTENDED_USE | Sell for $$$   | 2024-01-18 16:19:58.511
kosarko commented 7 months ago

@milanmajchrak To opakovani hodnot uz se nedeje, ale cekal bych, ze se do user_metadata ulozi i IP adresa. Nebo to se deje az kdyz kliknu na link v mailu? Na gmail aktualne maily nechodi, ale koukam, ze IP na dspace-devu neni ulozena u niceho:

dspace=# select distinct metadata_key from user_metadata;
     metadata_key
-----------------------
 INTENDED_USE
 REQUIRED_ORGANIZATION
 NAME
 SEND_TOKEN
(4 rows)
milanmajchrak commented 7 months ago

@kosarko Môžem potvrdiť, IP adresa sa neuklada, vytvorim issue a budeme na tom pracovať. https://github.com/dataquest-dev/dspace-angular/issues/602

kosarko commented 1 month ago

seems OK