Commits

Toby Inkster  committed 1bc4005

various updates

  • Participants
  • Parent commits 38bfc1d

Comments (0)

Files changed (8)

 ## Changes #################################################################
 ############################################################################
 
-<http://search.cpan.org/dist/RDF-ACL/#project>
-==============================================
+RDF-ACL
+=======
 
 Created:      2010-01-20
 Home page:    <http://search.cpan.org/dist/RDF-ACL/>
 Bug tracker:  <http://rt.cpan.org/Dist/Display.html?Queue=RDF-ACL>
 Maintainer:   Toby Inkster
 
+0.100 [2010-06-20]
+ - (Update) Support recent addition to ACL vocabulary - acl:Append.
+ - use Scalar::Util.
+
 0.01 [2010-01-20]
 
 @prefix dcs:     <http://ontologi.es/doap-changeset#> .
 @prefix dc:      <http://purl.org/dc/terms/> .
 @prefix foaf:    <http://xmlns.com/foaf/0.1/> .
-@prefix my:      <http://search.cpan.org/dist/RDF-ACL/#> .
+@prefix my:      <http://purl.org/NET/cpan-uri/dist/RDF-ACL/> .
 @prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
 @prefix toby:    <http://tobyinkster.co.uk/#> .
 @prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
 
 #############################################################
 
-my:v_0_01
+my:v_0-01
 
 	a               :Version ;
 	dc:issued       "2010-01-20"^^xsd:date ;
 	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-ACL-0.01.tar.gz> ;
 	rdfs:comment    "Original version"@en .
 
+my:v_0-100
+
+	a               :Version ;
+	dc:issued       "2010-06-20"^^xsd:date ;
+	:revision       "0.100"^^xsd:string ;
+	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-ACL-0.100.tar.gz> ;
+	dcs:changeset [
+		dcs:versus my:v_0-01 ;
+		dcs:item [ rdfs:label "Support recent addition to ACL vocabulary - acl:Append."@en ; a dcs:Update ] ;
+		dcs:item [ rdfs:label "use Scalar::Util."@en ] ;
+		] .
+
 #############################################################
 
 my:project
 	:tester         toby:i ;
 	:created        "2010-01-20"^^xsd:date ;
 	:license        <http://dev.perl.org/licenses/> ;
-	:release        my:v_0_01 .
+	:release        my:v_0-01 , my:v_0-100 .
 
 #############################################################
 
    xmlns:dc="http://purl.org/dc/terms/"
    xmlns:dcs="http://ontologi.es/doap-changeset#"
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
-   xmlns:my="http://search.cpan.org/dist/RDF-ACL/#"
+   xmlns:my="http://purl.org/NET/cpan-uri/dist/RDF-ACL/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:toby="http://tobyinkster.co.uk/#"
   <rdf:Description rdf:about="file:///home/tai/src/perlmods/RDF-ACL/Changes.ttl">
     <dc:creator rdf:resource="http://tobyinkster.co.uk/#i"/>
     <dc:description xml:lang="en">Revision history for Perl extension RDF::ACL.</dc:description>
-    <dc:subject rdf:resource="http://search.cpan.org/dist/RDF-ACL/#project"/>
+    <dc:subject rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-ACL/project"/>
     <dc:title>Changes</dc:title>
   </rdf:Description>
-  <Version rdf:about="http://search.cpan.org/dist/RDF-ACL/#v_0_01">
+  <Version rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-ACL/v_0-01">
     <dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2010-01-20</dc:issued>
-    <file-release rdf:resource="http://backpan.perl.org/authors/id/T/TO/TOBYINK/RDF-ACL-0.01.tar.gz"/>
+    <file-release rdf:resource="http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-ACL-0.01.tar.gz"/>
     <revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.01</revision>
     <rdfs:comment xml:lang="en">Original version</rdfs:comment>
   </Version>
-  <Project rdf:about="http://search.cpan.org/dist/RDF-ACL/#project">
+  <Version rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-ACL/v_0-100">
+    <dcs:changeset>
+      <rdf:Description>
+        <dcs:item>
+          <dcs:Update>
+            <rdfs:label xml:lang="en">Support recent addition to ACL vocabulary - acl:Append.</rdfs:label>
+          </dcs:Update>
+        </dcs:item>
+        <dcs:item>
+          <rdf:Description>
+            <rdfs:label xml:lang="en">use Scalar::Util.</rdfs:label>
+          </rdf:Description>
+        </dcs:item>
+        <dcs:versus rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-ACL/v_0-01"/>
+      </rdf:Description>
+    </dcs:changeset>
+    <dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2010-06-20</dc:issued>
+    <file-release rdf:resource="http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-ACL-0.100.tar.gz"/>
+    <revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.100</revision>
+  </Version>
+  <Project rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-ACL/project">
     <bug-database rdf:resource="http://rt.cpan.org/Dist/Display.html?Queue=RDF-ACL"/>
     <created rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2010-01-20</created>
     <developer rdf:resource="http://tobyinkster.co.uk/#i"/>
     <maintainer rdf:resource="http://tobyinkster.co.uk/#i"/>
     <name>RDF-ACL</name>
     <programming-language>Perl</programming-language>
-    <release rdf:resource="http://search.cpan.org/dist/RDF-ACL/#v_0_01"/>
+    <release rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-ACL/v_0-01"/>
+    <release rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-ACL/v_0-100"/>
     <repository>
       <SVNRepository>
         <browse rdf:resource="http://goddamn.co.uk/viewvc/perlmods/RDF-ACL/"/>
 configure_requires:
   ExtUtils::MakeMaker: 6.42
 distribution_type: module
-generated_by: 'Module::Install version 0.91'
+generated_by: 'Module::Install version 0.95'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
   homepage: http://search.cpan.org/dist/RDF-ACL/
   license: http://dev.perl.org/licenses/
   repository: http://goddamn.co.uk/viewvc/perlmods/RDF-ACL/
-version: 0.01
+version: 0.100

File RDF-ACL-0.100.tar.gz

Binary file added.
       $acl->save('turtle', 'access.ttl');
 
 VERSION
-    0.01
+    0.100
 
 DESCRIPTION
     Note that this module provides access control and does not perform
         $level is a URI identifying the type of access required. As special
         cases, the case-insensitive string 'read' is expanded to the URI
         <http://www.w3.org/ns/auth/acl#Read>, 'write' to
-        <http://www.w3.org/ns/auth/acl#Write> and 'control' to
+        <http://www.w3.org/ns/auth/acl#Write>, 'append' to
+        <http://www.w3.org/ns/auth/acl#Append> and 'control' to
         <http://www.w3.org/ns/auth/acl#Control>.
 
         If the access control list is local (not remote), zero or more

File lib/RDF/ACL.pm

 use Data::UUID;
 use Error qw(:try);
 use RDF::TrineShortcuts 0.03;
+use Scalar::Util qw(blessed);
 use URI;
 
 use constant NS_ACL   => 'http://www.w3.org/ns/auth/acl#';
 
 =head1 VERSION
 
-0.01
+0.100
 
 =cut
 
-our $VERSION = '0.01';
+our $VERSION = '0.100';
 
 =head1 DESCRIPTION
 
 	my $class = shift;
 	
 	my $model = shift;
-	unless (UNIVERSAL::isa($model, 'RDF::Trine::Model'))
+	unless (blessed($model) && $model->isa('RDF::Trine::Model'))
 	{
 		$model = rdf_parse($model, @_);
 	}
 $level is a URI identifying the type of access required. As special
 cases, the case-insensitive string 'read' is expanded to the URI
 E<lt>http://www.w3.org/ns/auth/acl#ReadE<gt>, 'write' to
-E<lt>http://www.w3.org/ns/auth/acl#WriteE<gt> and 'control' to
+E<lt>http://www.w3.org/ns/auth/acl#WriteE<gt>, 'append' to
+E<lt>http://www.w3.org/ns/auth/acl#AppendE<gt> and 'control' to
 E<lt>http://www.w3.org/ns/auth/acl#ControlE<gt>.
 
 If the access control list is local (not remote), zero or more
 	
 	if (defined $level)
 	{
-		if ($level =~ /^(access|read|write|control)$/i)
+		if ($level =~ /^(access|read|write|control|append)$/i)
 		{
 			$level = $aclvocab . (ucfirst lc $level);
 		}
 		while (my $result = $iterator->next)
 		{
 			push @rv, $result->{'level'}->uri
-				if UNIVERSAL::can($result->{'level'}, 'uri');
+				if blessed($result->{'level'}) && $result->{'level'}->can('uri');
 		}
 		return @rv;
 	}
 	
 	my $aclvocab = NS_ACL;
 	
-	if ($level =~ /^(access|read|write|control)$/i)
+	if ($level =~ /^(access|read|write|control|append)$/i)
 	{
 		$level = $aclvocab . (ucfirst lc $level);
 	}
 	my @rv;
 	while (my $result = $iterator->next)
 	{
-		if (UNIVERSAL::can($result->{'authorisation'}, 'uri'))
+		if (blessed($result->{'authorisation'}) && $result->{'authorisation'}->can('uri'))
 		{
 			push @rv, $result->{'authorisation'}->uri;
 		}
 					unless $control;
 			}
 
-			if ($p eq 'level' and $val =~ /^(access|read|write|control)$/i)
+			if ($p eq 'level' and $val =~ /^(access|read|write|control|append)$/i)
 			{
 				$val = NS_ACL . (ucfirst lc $val);
 			}

File t/03classes.t

 my $authid2 = $acl->allow(
 	'agent'       => ['http://example.com/fembot#me'],
 	'item_class'  => 'http://xmlns.com/foaf/0.1/PersonalProfileDocument',
-	'level'       => ['write', 'read']
+	'level'       => ['append', 'read']
 	);
 
 my $proper = <<CANON;
 <$authid2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/auth/acl#Authorization> .
 <$authid2> <http://www.w3.org/ns/auth/acl#accessToClass> <http://xmlns.com/foaf/0.1/PersonalProfileDocument> .
 <$authid2> <http://www.w3.org/ns/auth/acl#agent> <http://example.com/fembot#me> .
+<$authid2> <http://www.w3.org/ns/auth/acl#mode> <http://www.w3.org/ns/auth/acl#Append> .
 <$authid2> <http://www.w3.org/ns/auth/acl#mode> <http://www.w3.org/ns/auth/acl#Read> .
-<$authid2> <http://www.w3.org/ns/auth/acl#mode> <http://www.w3.org/ns/auth/acl#Write> .
 CANON
 $proper =~ s/\r?\n/\r\n/g;
 
 my @reasons2 = $acl->why(
 	'http://example.com/fembot#me',
 	'http://example.com/private/document',
-	'write',
+	'append',
 	$agent_info,
 	$document_info);
 is(1, scalar @reasons2, "second explanation works ok");
 ok(!$acl->check(
 		'http://example.com/fembot#me',
 		'http://example.com/private/document',
-		'write',
+		'APPEND',
 		$agent_info,
 		$document_info),
-	"removed write authorisation"
+	"removed append authorisation"
 	);
 
 ok($acl->check(
 		$agent_info,
 		$document_info),
 	"but kept read"
-	);
+	);