[livejournal] r17100: LJSUP-6519: viewall priv not working on ...
Committer: gariev
LJSUP-6519: viewall priv not working on beta, gamma, perhaps other serversU trunk/cgi-bin/LJ/Entry.pm U trunk/cgi-bin/LJ/S2/RecentPage.pm U trunk/cgi-bin/ljviews.pl
Modified: trunk/cgi-bin/LJ/Entry.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry.pm 2010-08-09 07:16:12 UTC (rev 17099)
+++ trunk/cgi-bin/LJ/Entry.pm 2010-08-09 09:42:24 UTC (rev 17100)
@@ -872,21 +872,15 @@
# is duplicate to LJ::can_view (LJ/User.pm), it is hard translate one to other because different entry attributes hashrefs
sub visible_to
{
- my ($self, $remote, $canview) = @_;
+ my ($self, $remote, $opts) = @_;
return 0 unless $self->valid;
- my ($viewall, $viewsome) = (0, 0);
- if ($canview) {
- $viewall = LJ::check_priv($remote, 'canview', '*');
- $viewsome = $viewall || LJ::check_priv($remote, 'canview', 'suspended');
- }
-
# can see anything with viewall
- return 1 if $viewall;
+ return 1 if $opts->{'viewall'};
# can't see anything unless the journal is visible
# unless you have viewsome. then, other restrictions apply
- if (!$viewsome) {
+ if (!$opts->{'viewsome'}) {
return 0 if $self->journal->{statusvis} =~ m/[DSX]/;
# can't see anything by suspended users
Modified: trunk/cgi-bin/LJ/S2/RecentPage.pm
===================================================================
--- trunk/cgi-bin/LJ/S2/RecentPage.pm 2010-08-09 07:16:12 UTC (rev 17099)
+++ trunk/cgi-bin/LJ/S2/RecentPage.pm 2010-08-09 09:42:24 UTC (rev 17100)
@@ -143,7 +143,7 @@
my $ditemid = $itemid * 256 + $item->{'anum'};
my $entry_obj = LJ::Entry->new($u, ditemid => $ditemid);
- next ENTRY unless $entry_obj->visible_to($remote);
+ next ENTRY unless $entry_obj->visible_to($remote, {'viewall' => $viewall, 'viewsome' => $viewsome});
$entry_obj->handle_prefetched_props($logprops{$itemid});
my $replycount = $logprops{$itemid}->{'replycount'};
Modified: trunk/cgi-bin/ljviews.pl
===================================================================
--- trunk/cgi-bin/ljviews.pl 2010-08-09 07:16:12 UTC (rev 17099)
+++ trunk/cgi-bin/ljviews.pl 2010-08-09 09:42:24 UTC (rev 17100)
@@ -1272,7 +1272,7 @@
my $ditemid = $itemid * 256 + $item->{'anum'};
my $entry_obj = LJ::Entry->new($u, ditemid => $ditemid);
- next ENTRY unless $entry_obj->visible_to($remote);
+ next ENTRY unless $entry_obj->visible_to($remote, {'viewall' => $viewall, 'viewsome' => $viewsome});
$entry_obj->handle_prefetched_props($logprops{$itemid});
my $replycount = $logprops{$itemid}->{'replycount'};
