success
fail
Boot bbmb and yus
masa@masa ~/ywesee/bbmb $ bin/bbmbd config="config.yml"
masa@masa ~/ywesee/yus $ bin/yusd server_url="druby://localhost:12001"
Check yus account
masa@masa ~/ywesee/yus $ bin/yus_show --server_url="druby://localhost:12001" mhatakeyama@ywesee.com Password for mhatakeyama@ywesee.com: ["mhatakeyama@ywesee.com", ["edit", [["yus.entities"]]], ["edti", [["yus.entities"]]], ["grant", [["create"], ["credit"], ["edit"], ["invoice"], ["login"], ["view"]]], ["login", [["ch.bbmb.Admin"], ["org.oddb.RootUser"], ["org.oddb.de.Admin"], ["org.oddb.de.PowerUser"]]], ["reset_password", []], ["set_password", [["mhatakeyama@ywesee.com"]]], ["view", [["org.oddb.de"]]], ["RootUser"]]
Confirm login with ch.bbmb.Admin
Change yus grant
masa@masa ~/ywesee/yus $ bin/yus_grant --server_url="druby://localhost:12001" --revoke mhatakeyama@ywesee.com login ch.bbmb.Admin Password for mhatakeyama@ywesee.com: revokeed permission to login ch.bbmb.Admin for mhatakeyama@ywesee.com from masa@masa ~/ywesee/yus $ bin/yus_show --server_url="druby://localhost:12001" mhatakeyama@ywesee.com Password for mhatakeyama@ywesee.com: ["mhatakeyama@ywesee.com", ["edit", [["yus.entities"]]], ["edti", [["yus.entities"]]], ["grant", [["create"], ["credit"], ["edit"], ["invoice"], ["login"], ["view"]]], ["login", [["org.oddb.RootUser"], ["org.oddb.de.Admin"], ["org.oddb.de.PowerUser"]]], ["reset_password", []], ["set_password", [["mhatakeyama@ywesee.com"]]], ["view", [["org.oddb.de"]]], ["RootUser"]] masa@masa ~/ywesee/yus $ bin/yus_grant --server_url="druby://localhost:12001" mhatakeyama@ywesee.com login ch.bbmb.Customer Password for mhatakeyama@ywesee.com: granted permission to login ch.bbmb.Customer for mhatakeyama@ywesee.com until masa@masa ~/ywesee/yus $ bin/yus_show --server_url="druby://localhost:12001" mhatakeyama@ywesee.com Password for mhatakeyama@ywesee.com: ["mhatakeyama@ywesee.com", ["edit", [["yus.entities"]]], ["edti", [["yus.entities"]]], ["grant", [["create"], ["credit"], ["edit"], ["invoice"], ["login"], ["view"]]], ["login", [["ch.bbmb.Customer"], ["org.oddb.RootUser"], ["org.oddb.de.Admin"], ["org.oddb.de.PowerUser"]]], ["reset_password", []], ["set_password", [["mhatakeyama@ywesee.com"]]], ["view", [["org.oddb.de"]]], ["RootUser"]]
No reboot bbmbd and yusd
Confirm login with ch.bbmb.Customer
bbmb error log
"BBMB::Html::Viral::Customer#_customer" @session.user.name="mhatakeyama@ywesee.com" Model::Customer.find_by_email(@session.user.name)=nil error in SBSM::Session#process: /de NoMethodError undefined method `current_order' for nil:NilClass /home/masa/ywesee/bbmb/lib/bbmb/html/state/current_order.rb:20:in `init' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:406:in `process' /home/masa/ywesee/bbmb/lib/bbmb/html/util/session.rb:45:in `process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:173:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `synchronize' "BBMB::Html::Viral::Customer#_customer" @session.user.name="mhatakeyama@ywesee.com" Model::Customer.find_by_email(@session.user.name)=nil error in SBSM::Session#process: /de/current_order/ NoMethodError undefined method `current_order' for nil:NilClass /home/masa/ywesee/bbmb/lib/bbmb/html/state/current_order.rb:20:in `init' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:406:in `process' /home/masa/ywesee/bbmb/lib/bbmb/html/util/session.rb:45:in `process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:173:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `synchronize' error in SBSM::Session#to_html: /de/current_order/ NoMethodError undefined method `empty?' for nil:NilClass /home/masa/ywesee/bbmb/lib/bbmb/html/view/current_order.rb:438:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:67:in `new' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:67:in `__standard_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:54:in `content' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:141:in `send' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:141:in `create' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/divcomposite.rb:33:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/divcomposite.rb:13:in `each' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/divcomposite.rb:13:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:272:in `new' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:272:in `view' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:192:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:496:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/redirector.rb:33:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `synchronize' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `drb_process' /usr/lib64/ruby/1.8/drb/drb.rb:1556:in `__send__' /usr/lib64/ruby/1.8/drb/drb.rb:1556:in `perform_without_block' /usr/lib64/ruby/1.8/drb/drb.rb:1516:in `perform' /usr/lib64/ruby/1.8/drb/drb.rb:1590:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1586:in `loop' /usr/lib64/ruby/1.8/drb/drb.rb:1586:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1582:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1582:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1431:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1428:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1428:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1348:in `initialize' /usr/lib64/ruby/1.8/drb/drb.rb:1628:in `new' /usr/lib64/ruby/1.8/drb/drb.rb:1628:in `start_service' bin/bbmbd:51 BBMB::Html::View::CurrentOrder::COMPONENTS[[0, 1]] in create(content) error in SBSM::Session#http_headers: /de/current_order/ NoMethodError undefined method `empty?' for nil:NilClass /home/masa/ywesee/bbmb/lib/bbmb/html/view/current_order.rb:438:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:67:in `new' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:67:in `__standard_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:54:in `content'
Notes
Preparation
config.yml
--- error_recipients: - mhatakeyama@ywesee.com bbmb_dir: /home/masa/ywesee/bbmb db_name: xxxxxx_bbmb db_user: xxxxxx db_pass: xxxxxx importers: "Kunden.txt": "CustomerImporter" load_files: - 'bbmb/util/csv_importer' log_level: DEBUG mail_order_to: mhatakeyama@ywesee.com mail_order_from: mhatakeyama@ywesee.com name: "Bbmb(Masa)" smtp_server: mail.ywesee.com smtp_authtype: :plain smtp_user: 'mhatakeyama@ywesee.com' smtp_pass: passwd target_format: csv inject_error_body: | inject_error_body inject_error_subject: 'Bestellung "%s" mit fehlendem Kunden: "%s"' inject_error_from: 'mhatakeyama@ywesee.com' inject_error_to: 'mhatakeyama@ywesee.com' mail_confirm_from: 'mhatakeyama@ywesee.com' mail_confirm_reply_to: 'mhatakeyama@ywesee.com' mail_confirm_subject: "Masa: Auftragsbestätigung %s" mail_confirm_lines: - "%3i x %-40s à %6.2f, total %7.2f" - "%3i x %-40s à %6.2f, total %7.2f" - "%3i x %-40s a %6.2f, totale %7.2f" mail_confirm_body: | mail_confirm_body confirm_error_body: | confirm_error_body confirm_error_subject: Kunde "%s" ohne hinterlegte Email-Adresse im Masa E-shop confirm_error_from: 'mhatakeyama@ywesee.com' confirm_error_to: 'mhatakeyama@ywesee.com' invoice?: false update?: true new_customer_mail: "mailto:mhatakeyama@ywesee.com?subject=Neukunde BBMB - bitte Passwort generieren" polling_file: '/home/masa/ywesee/bbmb/etc/polling.yml'
def run_updater @updater ||= Thread.new { loop { day = Date.today now = Time.now if(now.hour >= BBMB.config.update_hour) day += 1 end at = Time.local(day.year, day.month, day.day, # BBMB.config.update_hour) now.hour, now.min+1) print "at=" p at print "now=" p now secs = at - now BBMB.logger.debug("updater") { "sleeping %.2f seconds" % secs } sleep(secs) update } } end
Put Kunden.txt data
masa@masa ~/ywesee/bbmb $ ls data/ Kunden.txt
Put polling.yml file
masa@masa ~/ywesee/bbmb $ cat etc/polling.yml --- !ruby/object:BBMB::Util::FileMission backup_dir: var/backup directory: data glob_pattern: *.txt delete: false
Start bbmbd
masa@masa ~/ywesee/bbmb $ bin/bbmbd config="config.yml" ... at=Thu Nov 11 09:39:00 +0100 2010 now=Thu Nov 11 09:38:11 +0100 2010 I, [2010-11-11T09:38:11.979565 #12915] INFO -- start: starting bbmb-server on druby://localhost:12000 D, [2010-11-11T09:38:11.979619 #12915] DEBUG -- updater: sleeping 48.02 seconds
Result
at=Thu Nov 11 10:46:00 +0100 2010 now=Thu Nov 11 10:45:50 +0100 2010 I, [2010-11-11T10:45:50.130845 #14361] INFO -- start: starting bbmb-server on druby://localhost:12000 D, [2010-11-11T10:45:50.130897 #14361] DEBUG -- updater: sleeping 9.87 seconds "getin BBSB::Util::Server#update" "getin BBMB::Util::Updater#run" "getin PollingManager.poll_sources" "getin PollingManager.load_sources" BBMB.config.polling_file="/home/masa/ywesee/bbmb/etc/polling.yml" filename="Kunden.txt" "getin BBMB::Util::Updater#import" importer="CustomerImporter" klass=BBMB::Util::CustomerImporter args=[] count=2 D, [2010-11-11T10:46:00.010835 #14361] DEBUG -- updater: CustomerImporter imported 2 entities "done update"
New file
masa@masa ~/ywesee/bbmb $ ls var/backup -al insgesamt 4 drwxr-xr-x 2 masa masa 32 11. Nov 10:47 . drwxr-xr-x 3 masa masa 8 11. Nov 10:46 .. -rw-r--r-- 1 masa masa 326 11. Nov 10:46 Kunden.txt
Notes
Memo
[Thu Nov 11 09:22:11 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8n mod_ruby/1.3.0 Ruby/1.8.6(2009-06-08) configured -- resuming normal operations [Thu Nov 11 08:12:34 2010] [warn] Unable to load url configuration: No such file or directory - /home/masa/ywesee/bbmb/etc/trans_handler.yml [Thu Nov 11 08:12:34 2010] [notice] Hint: store configuration in a YAML-File at DOCUMENT_ROOT/../etc/trans_handler.yml
Question
Create a new customer yus account
masa@masa ~/ywesee/yus $ bin/yus_add_user --server_url="druby://localhost:12001" aaa@bbb.com bin/yus_add_user:18: warning: multiple values for a block parameter (2 for 1) from /usr/lib64/ruby/1.8/getoptlong.rb:613 Password for mhatakeyama@ywesee.com: New Password for aaa@bbb.com Repeat Password for aaa@bbb.com masa@masa ~/ywesee/yus $ bin/yus_show --server_url="druby://localhost:12001" aaa@bbb.com Password for mhatakeyama@ywesee.com: ["aaa@bbb.com", ["set_password", [["aaa@bbb.com"]]]] masa@masa ~/ywesee/yus $ bin/yus_grant --server_url="druby://localhost:12001" aaa@bbb.com login ch.bbmb.Customer Password for mhatakeyama@ywesee.com: granted permission to login ch.bbmb.Customer for aaa@bbb.com until masa@masa ~/ywesee/yus $ bin/yus_show --server_url="druby://localhost:12001" aaa@bbb.com Password for mhatakeyama@ywesee.com: ["aaa@bbb.com", ["login", [["ch.bbmb.Customer"]]], ["set_password", [["aaa@bbb.com"]]]]
Set email on browser
Login with the new account as a ch.bbmb.Customer
Result
Error log when login with a ch.bbmb.Customer account
"BBMB::Html::State::Login#login" "BBMB::Html::Util::Session#login" "getin login" "BBMB::Html::State::Login#login" "BBMB::Html::Util::Session#login" "getin login" D, [2010-11-11T11:48:11.907486 #15337] DEBUG -- User: aaa@bbb.com: allowed?(login, ch.bbmb.Admin) -> false D, [2010-11-11T11:48:11.908146 #15337] DEBUG -- User: aaa@bbb.com: allowed?(login, ch.bbmb.Customer) -> true "BBMB::Html::Viral::Customer#_customer" @session.user.name="aaa@bbb.com" Model::Customer.find_by_email(@session.user.name)=nil error in SBSM::Session#process: /de NoMethodError undefined method `current_order' for nil:NilClass /home/masa/ywesee/bbmb/lib/bbmb/html/state/current_order.rb:20:in `init' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:406:in `process' /home/masa/ywesee/bbmb/lib/bbmb/html/util/session.rb:45:in `process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:173:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `synchronize' "BBMB::Html::Viral::Customer#_customer" @session.user.name="aaa@bbb.com" Model::Customer.find_by_email(@session.user.name)=nil error in SBSM::Session#process: /de/current_order/ NoMethodError undefined method `current_order' for nil:NilClass /home/masa/ywesee/bbmb/lib/bbmb/html/state/current_order.rb:20:in `init' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:406:in `process' /home/masa/ywesee/bbmb/lib/bbmb/html/util/session.rb:45:in `process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:173:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `synchronize' error in SBSM::Session#to_html: /de/current_order/ NoMethodError undefined method `empty?' for #<SBSM::UnknownUser:0x7f7321b6aee0> /home/masa/ywesee/bbmb/lib/bbmb/html/view/current_order.rb:438:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:67:in `new' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:67:in `__standard_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:54:in `content' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:141:in `send' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:141:in `create' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/divcomposite.rb:33:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/divcomposite.rb:13:in `each' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/divcomposite.rb:13:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:272:in `new' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:272:in `view' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:192:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:496:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/redirector.rb:33:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `synchronize' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `drb_process' /usr/lib64/ruby/1.8/drb/drb.rb:1556:in `__send__' /usr/lib64/ruby/1.8/drb/drb.rb:1556:in `perform_without_block' /usr/lib64/ruby/1.8/drb/drb.rb:1516:in `perform' /usr/lib64/ruby/1.8/drb/drb.rb:1590:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1586:in `loop' /usr/lib64/ruby/1.8/drb/drb.rb:1586:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1582:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1582:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1431:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1428:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1428:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1348:in `initialize' /usr/lib64/ruby/1.8/drb/drb.rb:1628:in `new' /usr/lib64/ruby/1.8/drb/drb.rb:1628:in `start_service' bin/bbmbd:51 BBMB::Html::View::CurrentOrder::COMPONENTS[[0, 1]] in create(content) error in SBSM::Session#http_headers: /de/current_order/ NoMethodError undefined method `empty?' for #<SBSM::UnknownUser:0x7f7321b6aee0> /home/masa/ywesee/bbmb/lib/bbmb/html/view/current_order.rb:438:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:67:in `new' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:67:in `__standard_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:54:in `content'
Why
def init @model = _customer.current_order #<= HERE @model.calculate_effective_prices end
lib/bbmb/html/state/viral/customer.rb
def _customer @customer ||= Model::Customer.find_by_email(@session.user.name) end
Question
def init if(!@model.empty? || @lookandfeel.enabled?(:additional_info_first)) components.store([1,2], CurrentOrderForm) end super end
Notes
Davatz-san help Customer Login e-shop
The customer does not login via yus as far as I understand. You have to click onto the button: "Passwort generieren" in the customer view: http://dev.ywesee.com/uploads/$PageName//setemail.jpg That will generate a Passwort. With that Password you can then login. Of course you will also have to set an email-Address.
Note
If there is alread an account in yus database, it is IMPOSSIBLE to add 'email' data from web browser
9999 7601001380103 Masa Herr Hata Masa Apotheke zum ywesee GmbH Winterthulstrasse 111 1111 Zürich 044 111 00 11 044 111 00 11
Note
Note
def run_updater @updater ||= Thread.new { loop { day = Date.today now = Time.now if(now.hour >= BBMB.config.update_hour) day += 1 end at = Time.local(day.year, day.month, day.day, # BBMB.config.update_hour) now.hour, now.min+1) print "at=" p at print "now=" p now secs = at - now BBMB.logger.debug("updater") { "sleeping %.2f seconds" % secs } sleep(secs) update p "done update" sleep(100000) } } end
Notes
$ bin/yus_add_user [email] $ bin/yus_grant [email] login ch.bbmb.Admin $ bin/yus_show [email]
Login by using a ch.bbmb.Admin account
Check yus account
masa@masa ~/ywesee/yus $ bin/yus_show --server_url="druby://localhost:12001" aaa@bbb.com Password for mhatakeyama@ywesee.com: (druby://localhost:12001) /usr/lib64/ruby/site_ruby/1.8/yus/session.rb:160:in `find_or_fail': Unknown Entity 'aaa@bbb.com' (Yus::UnknownEntityError) from (druby://localhost:12001) /usr/lib64/ruby/site_ruby/1.8/yus/session.rb:358:in `show' from bin/yus_show:65
Set email address
Note
masa@masa ~/ywesee/yus $ bin/yus_show --server_url="druby://localhost:12001" aaa@bbb.com Password for mhatakeyama@ywesee.com: [u"aaa@bbb.com", ["set_password", [["aaa@bbb.com"]]]]
Notes
Push 'Passwort Generieren' button
Then the ch.bbmb.Customer privilege is added to the account
masa@masa ~/ywesee/yus $ bin/yus_show --server_url="druby://localhost:12001" aaa@bbb.com Password for mhatakeyama@ywesee.com: [u"aaa@bbb.com", ["login", [["ch.bbmb.Customer"]]], ["set_password", [["aaa@bbb.com"]]]]
Note
masa@masa ~/ywesee/yus $ bin/yus_passwd --server_url="druby://localhost:12001" aaa@bbb.com bin/yus_passwd:18: warning: multiple values for a block parameter (2 for 1) from /usr/lib64/ruby/1.8/getoptlong.rb:613 Password for mhatakeyama@ywesee.com: New Password for aaa@bbb.com: (Just enter) Repeat Password for aaa@bbb.com: (Just enter)
Then I can login without password as a customer