Skip to content

Commit

Permalink
Item14003: Back out Foswiki::Address - needs some work
Browse files Browse the repository at this point in the history
  • Loading branch information
Jlevens committed Mar 3, 2016
1 parent 0999b82 commit ee0fc42
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 97 deletions.
5 changes: 0 additions & 5 deletions UnitTestContrib/lib/Unit/TestRunner.pm
Expand Up @@ -604,11 +604,6 @@ sub runOne {
$tester->tear_down($test);
if (CHECKLEAK) {
_finish_singletons();

#require Devel::FindRef;
#foreach my $s (@Foswiki::Address::THESE) {
# print STDERR Devel::FindRef::track($s);
#}
}
}
}
Expand Down
22 changes: 0 additions & 22 deletions UnitTestContrib/test/unit/AccessControlTests.pm
Expand Up @@ -77,7 +77,6 @@ sub DENIED {
"$user $mode $web.$topic" );

if ($post11) {
require Foswiki::Address;
$this->assert(
!$this->{session}->access->haveAccess( $mode, $user, $topicObject ),
"$user $mode $web.$topic"
Expand All @@ -88,16 +87,6 @@ sub DENIED {
),
"$user $mode $web.$topic"
);
$this->assert(
!$this->{session}->access->haveAccess(
$mode, $user,
Foswiki::Address->new(
web => $topicObject->web,
topic => $topicObject->topic
)
),
"$user $mode $web.$topic"
);
}
$topicObject->finish();

Expand All @@ -113,7 +102,6 @@ sub PERMITTED {
"$user $mode $web.$topic" );

if ($post11) {
require Foswiki::Address;
$this->assert(
$this->{session}->access->haveAccess( $mode, $user, $topicObject ),
"$user $mode $web.$topic"
Expand All @@ -124,16 +112,6 @@ sub PERMITTED {
),
"$user $mode $web.$topic"
);
$this->assert(
$this->{session}->access->haveAccess(
$mode, $user,
Foswiki::Address->new(
web => $topicObject->web,
topic => $topicObject->topic
)
),
"$user $mode $web.$topic"
);
}
$topicObject->finish();

Expand Down
22 changes: 0 additions & 22 deletions UnitTestContrib/test/unit/AdminOnlyAccessControlTests.pm
Expand Up @@ -101,7 +101,6 @@ sub DENIED {
"$user $mode $web.$topic" );

if ($post11) {
require Foswiki::Address;
$this->assert(
!$this->{session}->access->haveAccess( $mode, $user, $topicObject ),
"$user $mode $web.$topic"
Expand All @@ -112,16 +111,6 @@ sub DENIED {
),
"$user $mode $web.$topic"
);
$this->assert(
!$this->{session}->access->haveAccess(
$mode, $user,
Foswiki::Address->new(
web => $topicObject->web,
topic => $topicObject->topic
)
),
"$user $mode $web.$topic"
);
}
$topicObject->finish();

Expand All @@ -137,7 +126,6 @@ sub PERMITTED {
"$user $mode $web.$topic" );

if ($post11) {
require Foswiki::Address;
$this->assert(
$this->{session}->access->haveAccess( $mode, $user, $topicObject ),
"$user $mode $web.$topic"
Expand All @@ -148,16 +136,6 @@ sub PERMITTED {
),
"$user $mode $web.$topic"
);
$this->assert(
$this->{session}->access->haveAccess(
$mode, $user,
Foswiki::Address->new(
web => $topicObject->web,
topic => $topicObject->topic
)
),
"$user $mode $web.$topic"
);
}
$topicObject->finish();

Expand Down
16 changes: 4 additions & 12 deletions core/lib/Foswiki/Access/TopicACLAccess.pm
Expand Up @@ -18,10 +18,9 @@ use constant MONITOR => 0;
use strict;
use Assert;

use Foswiki ();
use Foswiki::Address ();
use Foswiki::Meta ();
use Foswiki::Users ();
use Foswiki ();
use Foswiki::Meta ();
use Foswiki::Users ();

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
Expand All @@ -42,7 +41,6 @@ sub new {
---++ ObjectMethod haveAccess($mode, $User, $web, $topic, $attachment) -> $boolean
---++ ObjectMethod haveAccess($mode, $User, $meta) -> $boolean
---++ ObjectMethod haveAccess($mode, $User, $address) -> $boolean
* =$mode= - 'VIEW', 'CHANGE', 'CREATE', etc. (defaults to VIEW)
* =$cUID= - Canonical user id (defaults to current user)
Expand Down Expand Up @@ -74,13 +72,7 @@ sub haveAccess {
; #attachment ACL not currently supported in traditional topic ACL
}
else {
if ( ref($param1) eq 'Foswiki::Address' ) {
$meta =
Foswiki::Meta->load( $session, $param1->web(), $param1->topic() );
}
else {
$meta = $param1;
}
$meta = $param1;
}
ASSERT( $meta->isa('Foswiki::Meta') ) if DEBUG;

Expand Down
1 change: 0 additions & 1 deletion core/lib/Foswiki/Contrib/core/MANIFEST
Expand Up @@ -350,7 +350,6 @@ lib/Foswiki/Access/AdminOnlyAccess.pm 0444
lib/Foswiki/Access/TopicACLAccess.pm 0444
lib/Foswiki/Access/TopicACLReadOnlyAccess.pm 0444
lib/Foswiki/AccessControlException.pm 0444
lib/Foswiki/Address.pm 0444
lib/Foswiki/AggregateIterator.pm 0444
lib/Foswiki/Attach.pm 0444
lib/Foswiki/Attrs.pm 0444
Expand Down
16 changes: 7 additions & 9 deletions core/lib/Foswiki/Macros/META.pm
Expand Up @@ -4,8 +4,8 @@ package Foswiki;
use strict;
use warnings;

use Foswiki::Address ();
use Foswiki::Meta ();
use Foswiki::Meta ();
use Foswiki::Func ();

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
Expand All @@ -22,13 +22,11 @@ sub META {

my $option = $params->{_DEFAULT} || '';
if ( defined( $params->{topic} ) ) {
my $addrObj = Foswiki::Address->new(
web => $topicObject->web,
string => $params->{topic}
);
if ( !$addrObj->equiv($topicObject) ) {
my $meta =
new Foswiki::Meta( $this, $addrObj->web, $addrObj->topic );
my ( $nweb, $ntopic ) =
Foswiki::Func::normalizeWebTopicName( $topicObject->web,
$params->{topic} );
if ( $nweb ne $topicObject->web && $ntopic ne $topicObject->topic ) {
my $meta = new Foswiki::Meta( $this, $nweb, $ntopic );
$topicObject = $meta;
}
}
Expand Down
25 changes: 0 additions & 25 deletions core/lib/Foswiki/Meta.pm
Expand Up @@ -3823,31 +3823,6 @@ sub dataDecode {
return $datum;
}

=begin TML
---++ ClassMethod type() => $resourcetype
(see Foswiki::Address::type)
Returns the resource type name.
* webpath, Eg. =Web/SubWeb/=
* topic, Eg. =Web/SubWeb.
* undef, I have no idea whats going on, we're not there yet
=cut

sub type {
my ($this) = @_;

if ( defined( $this->{_web} ) ) {
if ( defined( $this->{_topic} ) ) {
return 'topic';
}
return 'webpath';
}
return;
}

1;
__END__
Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/, http://Foswiki.org/
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/MetaCache.pm
Expand Up @@ -103,7 +103,7 @@ sub finish {
---++ ObjectMethod hasCached($webtopic) -> boolean
returns true if the topic is already int he cache.
returns true if the topic is already in the cache.
=cut

Expand Down

0 comments on commit ee0fc42

Please sign in to comment.