Page actually broken, but protocol doesn't seem to have made it past 
the experimental stage (not on the openid website), so not worth the trouble to 
fixit.

        Patch by kareila. 

diffs (179 lines):

diff -r 9fa9bd025481 -r b2064b27ee3f cgi-bin/ljfeed.pl
--- a/cgi-bin/ljfeed.pl Fri Dec 17 16:39:07 2010 +0800
+++ b/cgi-bin/ljfeed.pl Fri Dec 17 16:50:55 2010 +0800
@@ -829,7 +829,7 @@ sub create_view_yadis {
         $view = "read";
     }
     else {
-        $view = undef;
+        $view = '';
     }
 
     if ($view eq 'recent') {
@@ -840,14 +840,6 @@ sub create_view_yadis {
             $println->('        <URI>'.LJ::ehtml($LJ::OPENID_SERVER).'</URI>');
             $println->('    </Service>');
         }
-    }
-    elsif ($view eq 'read') {
-        $println->('    <Service 
xmlns:gm="http://openid.net/xmlns/groupmembership/xrds";>');
-        $println->('        
<Type>http://openid.net/xmlns/groupmembership</Type>');
-        $println->('        
<URI>'.LJ::exml($LJ::SITEROOT).'/openid/groupmembership.bml</URI>');
-        $println->('        
<LocalID>'.LJ::exml($u->journal_base.'/read').'</LocalID>');
-        $println->('        <gm:CanEnumerate /><gm:CanQuery />');
-        $println->('    </Service>');
     }
 
     # Local site-specific content
diff -r 9fa9bd025481 -r b2064b27ee3f htdocs/openid/groupmembership.bml
--- a/htdocs/openid/groupmembership.bml Fri Dec 17 16:39:07 2010 +0800
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-<?_c
-# This code was forked from the LiveJournal project owned and operated
-# by Live Journal, Inc. The code has been modified and expanded by
-# Dreamwidth Studios, LLC. These files were originally licensed under
-# the terms of the license supplied by Live Journal, Inc, which can
-# currently be found at:
-#
-# 
http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt
-#
-# In accordance with the original license, this code and all its
-# modifications are provided under the GNU General Public License.
-# A copy of that license can be found in the LICENSE file included as
-# part of this distribution.
-_c?>
-<?_code
-
-    # This script implements the draft "OpenID Group Membership Protocol"
-    # See http://openid.net/wiki/index.php/Group_Membership_Protocol
-    #
-    # It exposes the friends of a user or the members of a community
-    # as a GMP group.
-
-    use strict;
-    use vars qw(%GET);
-
-    my $failnotfound = sub {
-        my $message = shift || "No such group";
-        BML::set_status(404);
-        BML::set_content_type("text/plain");
-        return $message;
-    };
-    my $forbidden = sub {
-        my $message = shift || "Forbidden";
-        BML::set_status(403);
-        BML::set_content_type("text/plain");
-        return $message;
-    };
-
-    # FIXME: Shouldn't hardcode these URL schemes here, but can't really
-    #   do anything much better than this without knowing the expected
-    #   username in advance.
-    my $findusername = sub {
-        my $uri = shift;
-
-        # YUCK: ljcom-isms. But we'll catch these below and bail out if we're 
not actually on ljcom.
-        # Only really care about P- and C-type journals for now. (although 
this'll catch S as well, handily)
-        return $1 if ($uri =~ m!^http://community.\Q$LJ::USER_DOMAIN\E/\w/$!);
-        return $1 if ($uri =~ m!^http://users.\Q$LJ::USER_DOMAIN\E/\w/$!);
-
-        return $1 if ($uri =~ m!^http://([a-z0-9\-]+).\Q$LJ::USER_DOMAIN\E/$!);
-        return $1 if ($uri =~ m!^\Q$LJ::SITEROOT\E/users/(\w+)/$!);
-        return $1 if ($uri =~ m!^\Q$LJ::SITEROOT\E/community/(\w+)/$!);
-
-        return undef;
-    };
-    my $findusernamefriends = sub {
-        my $uri = shift;
-        return $1 if ($uri =~ 
m!^http://([a-z0-9\-]+).\Q$LJ::USER_DOMAIN\E/read$!);
-        return $1 if ($uri =~ m!^\Q$LJ::SITEROOT\E/users/(\w+)/read$!);
-        return $1 if ($uri =~ m!^\Q$LJ::SITEROOT\E/community/(\w+)/read$!);
-
-        return $1 if ($uri =~ 
m!^http://community.\Q$LJ::USER_DOMAIN\E/\w/read$!);
-        return $1 if ($uri =~ m!^http://users.\Q$LJ::USER_DOMAIN\E/\w/read$!);
-        return undef;
-    };
-
-    return $failnotfound->("No group specified") unless 
($GET{'grpmember.group'});
-
-    BML::set_content_type("text/xml; charset=utf-8");
-    
-    my $groupuri = $GET{'grpmember.group'};
-    my $user = $findusernamefriends->($groupuri);
-
-    return $failnotfound->("Unrecognised URI") unless $user;
-    
-    # Having established what username we're trying to hit, let's try to load 
that user.
-    my $user = LJ::canonical_username($user);
-    my $u = LJ::load_user($user);
-    return $failnotfound->("No such user \"$user\"") unless $u;
-    
-    # Finally, make sure the canonical journal URL was used.
-    #  (this is where we catch all those ljcom-specific cases above, since 
they'll never match
-    #   on generic LJ)
-    return $failnotfound->("Must use canonical URI for group 
(".$u->journal_base."/read)") unless $groupuri eq $u->journal_base."/read";
-
-    # Now, are we checking membership or are we enumerating members?
-    my $memberuri = $GET{'grpmember.identifier'};
-
-    my $warning = "<!-- Note: Polite data miners cache on their end.  Impolite 
ones get banned.\n"
-                 ."     This is an experimental implementation of Group 
Membership Protocol, and as such it may change in incompatible ways as the spec 
develops. -->\n";
-    
-    if ($memberuri) {
-        # Check for a particular member    
-        my $memberuser = $findusername->($memberuri);
-        my $memberu;
-        
-        if ($memberuser) {
-            # It's (potentially) a local user
-            $memberuser = LJ::canonical_username($memberuser);
-            $memberu = LJ::load_user($memberuser);
-            $memberu = undef unless $memberu && $memberuri eq 
$memberu->journal_base."/";
-            $memberu = undef if $memberu && $memberu->is_identity; # Don't let 
identity users through this code path
-        }
-        elsif (LJ::OpenID::consumer_enabled()) {
-            # It's an external URI, but it might be an OpenID identifier known 
to this site        
-            $memberu = LJ::User::load_existing_identity_user('O', $memberuri);
-        }
-        
-        my $member = sub {
-            return qq{$warning<Member 
xmlns="http://openid.net/xmlns/groupmembership"; />};
-        };
-        my $nonmember = sub {
-            return qq{$warning<NonMember 
xmlns="http://openid.net/xmlns/groupmembership"; />};
-        };
-        
-        return $nonmember->() unless $memberu;
-        return $nonmember->() unless $u->trusts_or_has_member( $memberu );
-        return $member->();
-    }
-    else {
-        # Enumerate all members
-
-        my @ids = $u->friend_uids;
-        
-        # Arbitrary: if there are more than 500 friends, we don't allow 
enumeration
-        # for this group.
-        return $forbidden->("Group is too large; enumeration not allowed") if 
scalar(@ids) > 500;
-        
-        my %fr;
-        LJ::load_userids_multiple([ map { $_ => \$fr{$_} } @ids ]);
-        
-        my $identifieruri = sub {
-            my ($u) = @_;
-            if ($u->is_identity && $u->identity->typeid eq 'O') {
-                return $u->identity->value;
-            }
-            else {
-                return $u->journal_base."/";            
-            }
-        };
-        
-        return "$warning<Members 
xmlns=\"http://openid.net/xmlns/groupmembership\";>\n"
-              .join("\n", map { "<Member 
uri=\"".LJ::exml($identifieruri->($_))."\" />" } values %fr)
-              ."\n</Members>";
-        
-    }
-
-_code?>
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to