Permalink
Browse files

mobile::attribute に依存しないかたちに 

  • Loading branch information...
1 parent a400896 commit 9746e339fc8454bc41ae4588c42fdd902e1b1cb2 @nekokak committed Mar 10, 2010
Showing with 31 additions and 0 deletions.
  1. +31 −0 lib/Kamui/Plugin/Session/State/MobileAgentUserID.pm
@@ -0,0 +1,31 @@
+package Kamui::Plugin::Session::State::MobileAgentUserID;
+use Kamui;
+
+sub new {
+ my $class = shift;
+
+ bless +{
+ c => undef,
+ @_
+ }, $class,
+}
+
+sub get_session_id {
+ my $self = shift;
+
+ my $ma = $self->{c}->mobile;
+ if ($ma->can('user_id') and (my $user_id = $ma->user_id)) {
+ # TODO: ip check
+ return $user_id;
+ } else {
+ return '';
+ }
+}
+
+sub generate_session_id { $_[0]->get_session_id }
+sub set_session_id {}
+sub remove_session_id {}
+sub finalize {}
+
+1;
+

0 comments on commit 9746e33

Please sign in to comment.