| Class | DesignService |
| In: |
lib/design_api.rb
|
| Parent: | ActionWebService::Base |
proposal に従ってログイン処理を行う。
# File lib/design_api.rb, line 476
476: def login(proposal)
477: p0, p1 = proposal.parameter_0, proposal.parameter_1
478: if p0.empty? || p1.empty? # failed
479: return false
480: end
481: if user = User.authenticate(p0, p1, true)
482: if ticket = DesignTicket.give(user)
483: approval = LoginStruct::Approval.new(:client_identifier_x => ticket.user_id,
484: :client_identifier_y => ticket.domain_id,
485: :client_identifier_z => ticket.token)
486: return approval
487: end
488: end
489: # failed
490: return false
491: end
proposal に従ってログアウト処理を行う。
# File lib/design_api.rb, line 494
494: def logout(proposal)
495: if ticket = DesignTicket.take(:user_id => proposal.client_identifier_x,
496: :domain_id => proposal.client_identifier_y,
497: :token => proposal.client_identifier_z,
498: :invalidate => true)
499: approval = LogoutStruct::Approval.new(:client_identifier_x => ticket.user_id,
500: :client_identifier_y => ticket.domain_id,
501: :client_identifier_z => ticket.token)
502: return approval
503: end
504: return false
505: end