[librecat-dev] user update not reflected in user list on account search page

Jonathan NORRIS jnorris at ist.ac.at
Wed Feb 28 12:32:06 CET 2018


Hello,

I synchronize users in my librecat system with our institutes users by 
running a script that creates a users yaml file from users pulled from a 
web service and then runs 'bin/librecat user add /path/to/file.yml'. It 
first runs an export of the current users to get the user ids of the 
existing users so my script can add the ids to the users and have them 
update instead of a new user create. An example of one of the user 
entries in the yaml file is:

---
_id: C77F1572-130C-11E8-AFB6-806D539212D2
account_status: active
date_created: 2018-02-16 11:38:27
date_updated: 2018-02-16 11:38:27
department:
- {_id: CampIT}
email: jnorris at ist.ac.at
first_name: Jonathan
full_name: Jonathan Norris
last_name: Norris
login: jnorris
password: sdjslkdjslkfjslkdjfslkdjfl
photo: https://icp.ist.ac.at/data/img/profile/medium/jnorris_uvGZW.jpg
style: chicago
super_admin: 1
...

I update the users and everything works fine except that when I see the 
list of accounts at '/admin/account/search' the updated data is not 
reflected in the list. For example, I had a user who's account was 
inactive and displaying the red inactivity tag in the accounts list. 
Then I run the user sync script which updated the user to have its 
account as active. But when I see the account in the list the activity 
tag is still red and inactive. However when I got to the edit form for 
that account the data is correctly updated.

 From the code it looks like it is pulling the list from the database:

=head2 GET /account/search

Searches the authority database. Prints the search form + result list.

=cut

     get '/account/search' => sub {
         my $p = params;
         h->log->debug("query for researcher: " . to_dumper($p));
         my $hits = LibreCat->searcher->search('user', $p);
         template 'admin/account', $hits;
     };

Could it be that when 'bin/librecat user add /path/to/file.yml' is ran 
it is only updating the index and not the database? Is this expected or 
should it update both the index and database?

When I run 'bin/librecat user get A13E982A-1266-11E8-9236-8266539212D2' 
I get (account active):

---
_id: A13E982A-1266-11E8-9236-8266539212D2
account_status: active
date_created: 2018-02-15 15:41:03
date_updated: 2018-02-28T10:20:06Z
department:
- _id: CaGu
email: mstein at ist.ac.at
first_name: Magdalena
full_name: Magdalena Steinrück
last_name: Steinrück
login: mstein
photo: https://icp.ist.ac.at/data/img/profile/medium/mstein.jpg
...

When I run 'bin/librecat user export 
A13E982A-1266-11E8-9236-8266539212D2' I get (account inactive, also old 
department):

---
_id: A13E982A-1266-11E8-9236-8266539212D2
account_status: inactive
date_created: 2018-02-15T15:41:03Z
date_updated: 2018-02-15T15:41:03Z
department:
- _id: Guet
email: mstein at ist.ac.at
first_name: Magdalena
full_name: Magdalena Steinrück
last_name: Steinrück
login: mstein
photo: https://icp.ist.ac.at/data/img/profile/medium/mstein.jpg
...

Does 'get' take it from the index and 'export' take it from the database?


Thanks for any insight,

Jonathan

IST Austria

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20180228/dbe30c12/attachment.html>


More information about the librecat-dev mailing list