view · edit · sidebar · attach · print · history

Index>

20140930-fix-stammdaten-export-papyal

Summary

  • Fix Stammdaten export via paypal

Commits

Index

Keep in Mind
  • Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • Fix analyses search. Eg. for Akute myeloische Leukämie

---

Fix Stammdaten export via paypal

I want first to know why on oddb-ci2 there are no "Gruppen" displayed when looking at URL like http://oddb-ci2.dyndns.org/de/gcc/user/name/20140922-163131%40ywesee.com, as this might be one of the reasons I cannot get a download of Stammdaten containing at least the header line.

Calling /usr/bin/ruby /usr/local/src/yus18/bin/yus_show ngiger@ywesee.com on oddb-ci2 I get prompted for the password and see stuff like

["ngiger@ywesee.com",
 ["create", [["org.oddb.registration"], ["org.oddb.task.background"]]],
 ["credit", [["org.oddb.download"]]],
 ["edit",
  [["org.oddb.drugs"],
   ["org.oddb.model.!address.*"],
   ["org.oddb.model.!atc_class.*"],
   ["org.oddb.model.!company.*"],
   ["org.oddb.model.!galenic_group.*"],
   ["org.oddb.model.!indication.*"],
   ["org.oddb.model.!sponsor.*"],
   ["yus.entities"]]],
 ["grant", [["create"], ["credit"], ["edit"], ["login"], ["view"]]],
 ["login",
  [["org.oddb.AdminUser"],
   ["org.oddb.CompanyUser"],
   ["org.oddb.PowerLinkUser"],
   ["org.oddb.PowerUser"],
   ["org.oddb.RootUser"]]],
 ["reset_password",
  [["108fe4086ae90e046c597524f3756666", Sat Sep 20 13:16:00 +0200 2014],
   ["f7f833454b2830dc79f9462b97825555", Sat Sep 20 13:37:09 +0200 2014]]],
 ["set_password", [["ngiger@ywesee.com"]]],
 ["view", [["oddb.org"], ["org.oddb.patinfo_stats"]]]]

which does not contain any affiliation.

Did set net password of yus by executing /usr/local/bin/ruby /usr/local/lib64/ruby/gems/1.9.1/gems/yus-1.0.0/sha256.rb new_password and adding its output into /etc/yus/yus.yml.

Copied yus database from thinpower (/var/backup/thinpower/db/postgresql/September-2014/2014-09-29/22:00-postgresql_database-yus-backup.gz) to oddb-ci2 to import it there. Stopped service yus, dropped and create yus database yus via psql. Then executed gunzip --to-stdout /opt/db_dumps/pg-db-yus-backup.gz | sudo -u postgres psql --dbname=yus

After resetting manually my password I can login again, but visibly I am no longer a root user.

After a discussion with Zeno we decided to install on oddb-ci2 exactly the same Ruby 1.8 version as on thinpower (ruby 1.8.6 (2008-03-03 patchlevel 114) [x86_64-linux]), setup yus starting from an empty database as before. I will also apply a small patch to yus to log the outcome of each allowed? entry. See commit Log result of allowed?

  • Install YUS under ruby 1.8.6

I am having problems compiling 1.8.6 from a git clone as I get

math.c: In function 'domain_check':
math.c:37:13: error: missing binary operator before token "("
file.c:819:1: error: static declaration of 'group_member' follows non-static declaration
/usr/include/unistd.h:715:12: note: previous declaration of 'group_member' was here
Makefile:168: recipe for target 'math.o' failed
make: *** [math.o] Error 1
make: *** Waiting for unfinished jobs....
Makefile:168: recipe for target 'file.o' failed
make: *** [file.o] Error 1

Looking for a tarball of 1.8.6. Downloading from http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p114.tar.bz2. Verifying SHA512 4ac0d0271324c54525210f775e5fcc9a37e3d8a10b96d68cdfeeb361c6f64a63 against downloaded sha256sum ruby-1.8.6-p114.tar.bz2 is okay. Running

./configure --prefix=/usr/local/ruby-1.8.6-p114
 make
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c array.c
<..>
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c math.c
math.c: In function 'domain_check':
math.c:37:13: error: missing binary operator before token "("
Makefile:168: recipe for target 'math.o' failed
make: *** [math.o] Error 1

Gives the same error. Even rbenv only claims supports 1.8.6-p383 and p420, but fails to compile them. RVM however is able to compile 1.8.6-p420, but fails with 1.8.6-p114, too. I think that I don't try to fix the problem with math.c as in my experience this will be just the first in long list of similar problems which whould consume way too much time to resolve.

Okay. Under the apache user I used rvm to install ruby-1.8.6-p420. Changed the path in .bashrc to export PATH="$HOME/.rvm/bin:/usr/bin:/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.4". Then I manually had to tweak installing the needed gems for yus like this

gem install needle odba rclconf
gem install deprecated --version=2.0.1
gem install pg --version 0.12.0 --force # Complained that it run only under Ruby 1.8.7
gem install dbd-pg
gem install ruby-password # for yus_add/grant

But now I get an error ruby: no such file to load -- auto_gem (LoadError) whether I have the environment variabel RUBYOPT set to -rauto_gem or not. Trying to compile an unpatched ruby-1.8.6-p420. This fails too with

ossl_pkcs7.c:634:5: Warnung: Übergabe des Arguments 1 von »ossl_x509crl_sk2ary« von inkompatiblem Zeigertyp [standardmäßig aktiviert]
ossl.h:121:7: Anmerkung: »struct stack_st_X509_CRL *« erwartet, aber Argument hat Typ »int *«
Makefile:179: recipe for target 'ossl_pkcs7.o' failed
make[1]: *** [ossl_pkcs7.o] Error 1
]]

Fixed thr problem using rvm and adding a line @@require 'rubygems'@@ in bin/yusd (and all other executables under bin). Changed @@/service/yus/run@@ to @@exec sudo -u apache /var/www/.rvm/rubies/ruby-1.8.6-p420/bin/ruby bin/yusd@@
[@
sudo -u postgres  dropdb yus
 sudo -u postgres createdb -E UTF8 -T template0 yus

Now initialized yus with (running under user apache) (with http://dev.ywesee.com/uploads/att/yus-setup-20120604.txt)

/usr/local/src/yus18/bin/yus_add_user ngiger@ywesee.com login org.oddb.RootUser

/usr/local/src/yus18/bin/yus_grant ngiger@ywesee.com edit yus.entities
/usr/local/src/yus18/bin/yus_grant ngiger@ywesee.com credit org.oddb.download
/usr/local/src/yus18/bin/yus_grant ngiger@ywesee.com view org.oddb.de
/usr/local/src/yus18/bin/yus_grant ngiger@ywesee.com login org.oddb.de.Admin
/usr/local/src/yus18/bin/yus_grant ngiger@ywesee.com RootUser

I am comparing now the output (on thinpower) for zdavatz

/usr/bin/ruby /usr/bin/yus_show zdavatz@ywesee.com
Password for zdavatz@ywesee.com: 
["zdavatz@ywesee.com",
 ["credit", [["org.oddb.download"]]],
 ["login", [["org.oddb.de.Admin"]]],
 ["set_password", [["zdavatz@ywesee.com"]]],
 ["view", [["org.oddb.de"]]],
 ["RootUser"]]

with mine on oddb-ci2

/usr/local/src/yus18/bin/yus_show ngiger@ywesee.com 
/var/www/.rvm/gems/ruby-1.8.6-p420@global/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:89: warning: parenthesize argument(s) for future version
Password for ngiger@ywesee.com: 
["ngiger@ywesee.com",
 ["credit", [["org.oddb.download"]]],
 ["login", [["org.oddb.RootUser"], ["org.oddb.de.Admin"]]],
 ["rootuser", [["everything"]]],
 ["set_password", [["ngiger@ywesee.com"]]],
 ["view", [["org.oddb.de"]]]]

The RootUser is different, between these two users/instances.

After resetting my user password and login in again I can open now http://oddb-ci2.dyndns.org/de/gcc/home_admin/, but the Users are not displayed there. After executing under bin/admin yus_grant 'ngiger@ywesee.com', 'login', 'org.oddb.RootUser', :never. I was able to go directly to http://oddb-ci2.dyndns.org/de/gcc/users/ (but http://oddb-ci2.dyndns.org/de/gcc/home_admin/ still did not show a link "Benutzer" under http://oddb-ci2.dyndns.org/de/gcc/home_admin/).

And there it says "No user found". See

Patched yus to show the results. See Attach:patch_yus_allowed.txt

When I try to download the the csv for Zulassungsinhaber desitin I arrive now (faster than before) to the error map and see the following output of the yusd.

I, [2014-09-30T17:19:21.593528 #10910]  INFO -- start: starting yus-server on drbssl://localhost:9997
I, [2014-09-30T17:21:31.279998 #10910]  INFO -- Yus::Server: Token-Authentication succeeded for ngiger@ywesee.com
D, [2014-09-30T17:21:31.310267 #10910] DEBUG -- Yus::TokenSession: allowed?(login, org.oddb.RootUser) returns true
Started with entering Desiting and search for Zulassungsinhaber on http://oddb-ci2.dyndns.org
D, [2014-09-30T17:21:47.522339 #10910] DEBUG -- Yus::AutoSession: get_entity_preference(name=ngiger@ywesee.com, key=association, domain=oddb.org)
D, [2014-09-30T17:21:47.526165 #10910] DEBUG -- Yus::TokenSession: allowed?(edit, org.oddb.drugs) returns false
D, [2014-09-30T17:21:47.541086 #10910] DEBUG -- Yus::TokenSession: allowed?(edit, org.oddb.model.!atc_class.*) returns false

Exporting the yus database (sudo -u postgres pg_dump yus > yus_db.dump.oddb-ci2) and loading the database from thinpower. I want to see what is really in the yus db. Adding an option to dump the content to a yaml.

Done in branch without_needle with commit Added option to dump yus to yaml

Tomorrow I will port this change to the master branch and look whether it works with Ruby 1.8.6 and the DB from thinpower.

view · edit · sidebar · attach · print · history
Page last modified on October 01, 2014, at 02:12 PM