madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r22588: LJSUP-13200: json rpc auth refactoring

Committer: sbelyaev
LJSUP-13200: json rpc auth refactoring
U   trunk/cgi-bin/LJ/JSON/RPC/Item.pm
U   trunk/cgi-bin/LJ/JSON/RPC.pm
Modified: trunk/cgi-bin/LJ/JSON/RPC/Item.pm
===================================================================
--- trunk/cgi-bin/LJ/JSON/RPC/Item.pm	2012-08-07 14:10:30 UTC (rev 22587)
+++ trunk/cgi-bin/LJ/JSON/RPC/Item.pm	2012-08-07 14:19:34 UTC (rev 22588)
@@ -52,7 +52,8 @@
     $self->{'method'}      = $method;
     $self->{'params'}      = $params;
     $self->{'access_type'} = $access->{'type'};
- 
+    $self->{'access_data'} = $access->{'data'};
+
     return $self;
 }
 
@@ -155,6 +156,16 @@
     return $resp;
 }
 
+sub access_type {
+    my ($self) = @_;
+    return $self->{'access_type'};
+}
+
+sub access_data {
+    my ($self) = @_;
+    return $self->{'access_data'};
+}
+
 sub error {
     my ($self) = @_;
     return $self->{'fatal'};

Modified: trunk/cgi-bin/LJ/JSON/RPC.pm
===================================================================
--- trunk/cgi-bin/LJ/JSON/RPC.pm	2012-08-07 14:10:30 UTC (rev 22587)
+++ trunk/cgi-bin/LJ/JSON/RPC.pm	2012-08-07 14:19:34 UTC (rev 22588)
@@ -71,18 +71,20 @@
 sub __call_item {
     my ($self, $entry, $callback) = @_;
 
-    my $call_info = { 
-        'source'   => 'jsonrpc',
-        'type'     => $self->{'callback'} ? 'jsonp' : 'CORS',
-        'hostname' => LJ::Request->hostname,
-    };
-
     my $item   = $entry->{'item'};
     return if $item->error;
 
     my $method = $item->method;
     my $params = $item->params;
 
+    my $call_info = {
+        'source'        => 'jsonrpc',
+        'type'          => $self->{'callback'} ? 'jsonp' : 'CORS',
+        'hostname'      => LJ::Request->hostname,
+        'access_type'   => $item->access_type,
+        'access_data'   => $item->access_data,
+    };
+
     $entry->{'result'} = $callback->($method, $params, $call_info);
 }
 

Tags: livejournal, madeon, pm, sbelyaev
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments