.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "RDF::ACL 3pm" .TH RDF::ACL 3pm "2012-05-30" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" RDF::ACL \- access control lists for the semantic web .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use RDF::ACL; \& \& my $acl = RDF::ACL\->new(\*(Aqaccess.ttl\*(Aq); \& my $auth = $acl\->allow( \& webid => \*(Aqhttp://example.com/joe#me\*(Aq, \& item => \*(Aqhttp://example.com/private/document\*(Aq, \& level => [\*(AqRead\*(Aq, \*(AqWrite\*(Aq], \& ); \& $acl\->save(\*(Aqturtle\*(Aq, \*(Aqaccess.ttl\*(Aq); \& \& # later... \& \& if ($acl\->check(\*(Aqhttp://example.com/joe#me\*(Aq, \& \*(Aqhttp://example.com/private/document\*(Aq, \& \*(AqRead\*(Aq)) \& { \& print slurp("private/document"); \& } \& else \& { \& print "Denied"; \& } \& \& # later... \& \& foreach my $reason ($acl\->why(\*(Aqhttp://example.com/joe#me\*(Aq, \& \*(Aqhttp://example.com/private/document\*(Aq, \& \*(AqRead\*(Aq)) \& { \& $acl\->deny($reason) if defined $reason; \& } \& $acl\->save(\*(Aqturtle\*(Aq, \*(Aqaccess.ttl\*(Aq); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Note that this module provides access control and does not perform authentication! .SS "Constructors" .IX Subsection "Constructors" .ie n .IP """$acl\->new($input, %args)""" 4 .el .IP "\f(CW$acl\->new($input, %args)\fR" 4 .IX Item "$acl->new($input, %args)" Creates a new access control list based on \s-1RDF\s0 data defined in \&\f(CW$input\fR. \f(CW$input\fR can be a serialised string of \s-1RDF\s0, a file name, a \s-1URI\s0 or any other input accepted by the \f(CW\*(C`parse\*(C'\fR function of RDF::TrineX::Functions. .Sp \&\f(CW\*(C`new()\*(C'\fR can be called with no arguments to create a fresh, clean \s-1ACL\s0 containing no authorisations. .ie n .IP """$acl\->new_remote($endpoint)""" 4 .el .IP "\f(CW$acl\->new_remote($endpoint)\fR" 4 .IX Item "$acl->new_remote($endpoint)" Creates a new access control list based on \s-1RDF\s0 data accessed via a remote \s-1SPARQL\s0 Protocol 1.0 endpoint. .SS "Public Methods" .IX Subsection "Public Methods" .ie n .IP """$acl\->check($webid, $item, $level, @data)""" 4 .el .IP "\f(CW$acl\->check($webid, $item, $level, @data)\fR" 4 .IX Item "$acl->check($webid, $item, $level, @data)" Checks an agent's authorisation to access an item. .Sp \&\f(CW$webid\fR is the WebID (\s-1URI\s0) of the agent requesting access to the item. .Sp \&\f(CW$item\fR is the \s-1URL\s0 (\s-1URI\s0) of the item being accessed. .Sp \&\f(CW$level\fR is a \s-1URI\s0 identifying the type of access required. As special cases, the case-insensitive string 'read' is expanded to the \s-1URI\s0 , 'write' to , 'append' to and 'control' to . .Sp If the access control list is local (not remote), zero or more additional \s-1RDF\s0 graphs can be passed (i.e. \f(CW@data\fR) containing data to take into consideration when checking the agent's authorisation. This data is trusted blindly, so should not include data that the user has themselves supplied. If the access control list is remote, then this method throws an error if any additional data is provided. (A remote \s-1ACL\s0 cannot take into account local data.) .Sp If \f(CW$level\fR is provided, this method returns a boolean. .Sp If \f(CW$level\fR is undefined or omitted, this method returns a list of URIs which each represent a type of access that the user is authorised. .ie n .IP """$acl\->why($webid, $item, $level, @data)""" 4 .el .IP "\f(CW$acl\->why($webid, $item, $level, @data)\fR" 4 .IX Item "$acl->why($webid, $item, $level, @data)" Investigates an agent's authorisation to access an item. .Sp Arguments as per \f(CW\*(C`check\*(C'\fR, however \f(CW$level\fR is required. .Sp Returns a list of authorisations that justify a user's access to the item with the given access level. These authorisations are equivalent to \f(CW$authid\fR values provided by \f(CW\*(C`allow()\*(C'\fR. .Sp In some cases (especially if the authorisation was created by hand, and not via \f(CW\*(C`allow()\*(C'\fR) an authorisation may not have an identifier. In these cases, the list will contain undef. .ie n .IP """$acl\->allow(%args)""" 4 .el .IP "\f(CW$acl\->allow(%args)\fR" 4 .IX Item "$acl->allow(%args)" Adds an authorisation to the \s-1ACL\s0. The \s-1ACL\s0 must be mutable. .Sp The method takes a hash of named arguments: .Sp .Vb 5 \& my $authid = $acl\->allow( \& webid => \*(Aqhttp://example.com/joe#me\*(Aq, \& item => \*(Aqhttp://example.com/private/document\*(Aq, \& level => [\*(AqRead\*(Aq, \*(AqWrite\*(Aq], \& ); .Ve .Sp \&'item' is the \s-1URI\s0 of the item to authorise access to. As an alternative, \&'item_class' may be used to authorise access to an entire class of items (using classes in the \s-1RDFS/OWL\s0 sense of the word). If neither of these arguments is provided, then the method will throw an error. Both may be provided. Either or both may be an arrayref, because an authorisation may authorise access to more than one thing. .Sp \&'container' is an alternative to using 'item' or 'item_class'. It specifies the \s-1URI\s0 for a resource which in some way is a container for other resources. Setting authorisations for a container allows you to set a default authorisation for new items created within that container. (You must use the \f(CW\*(C`created()\*(C'\fR method to notify the \s-1ACL\s0 about newly created items.) .Sp \&'webid' is the WebID (\s-1URI\s0) of the person or agent being granted access. As an alternative, 'agent_class' may be used to authorise access to an entire class of agents. If neither is provided, an agent_class of is assumed. Both may be provided. Either or both may be an arrayref, because an authorisation may authorise access by more than one agent. (For consistency with 'item', \&'agent' is supported as a synonym for 'webid'.) .Sp \&'level' is the access level being granted. As with the \f(CW\*(C`check\*(C'\fR method, the shortcuts 'read', 'write', 'append' and 'control' may be used. An arrayref may be used. If no level is specified, 'read' is assumed. .Sp This authorisation is not automatically saved, so it is probably useful to call \f(CW\*(C`save()\*(C'\fR after adding authorisations. .Sp The method returns an identifier for the authorisation. This identifier may be needed again if you ever need to \f(CW\*(C`deny()\*(C'\fR the authorisation. .Sp This method is aware of \f(CW\*(C`i_am()\*(C'\fR/\f(CW\*(C`who_am_i()\*(C'\fR. .ie n .IP """$acl\->deny($authid)""" 4 .el .IP "\f(CW$acl\->deny($authid)\fR" 4 .IX Item "$acl->deny($authid)" Completely removes all traces of an authorisation from the \s-1ACL\s0. .Sp The authorisation identifier can be found using \f(CW\*(C`why()\*(C'\fR or you may have remembered it when you first allowed the access. In some cases (especially if the authorisation was created by hand, and not via \f(CW\*(C`allow()\*(C'\fR) an authorisation may not have an identifier. In these cases, you will have to be creative in figuring out how to deny access. .Sp Returns the number of statements removed from the \s-1ACL\s0's internal model as a result of the removal. (This will normally be at least 3.) .Sp This authorisation is not automatically saved, so it is probably useful to call \f(CW\*(C`save()\*(C'\fR after removing authorisations. .Sp This method is aware of \f(CW\*(C`i_am()\*(C'\fR/\f(CW\*(C`who_am_i()\*(C'\fR. .ie n .IP """$acl\->created($item, $container)""" 4 .el .IP "\f(CW$acl\->created($item, $container)\fR" 4 .IX Item "$acl->created($item, $container)" Finds all authorisations which are the default for new items within \&\f(CW$container\fR and clones each of them for newly created \f(CW$item\fR. .Sp Returns a list of authorisation identifiers. .ie n .IP """$acl\->i_am($webid)""" 4 .el .IP "\f(CW$acl\->i_am($webid)\fR" 4 .IX Item "$acl->i_am($webid)" Tells the \s-1ACL\s0 object to \*(L"act like\*(R" the agent with the given WebID. .Sp If the \s-1ACL\s0 object is acting like you, then methods that make changes to the \s-1ACL\s0 (e.g. \f(CW\*(C`allow()\*(C'\fR and \f(CW\*(C`deny()\*(C'\fR) will only work if you have 'Control' permission over the resources specified. .Sp \&\f(CW$webid\fR can be null to restore the usual behaviour. .Sp Returns the previous WebID the \s-1ACL\s0 was acting like as a \s-1URI\s0 object. .ie n .IP """$acl\->who_am_i""" 4 .el .IP "\f(CW$acl\->who_am_i\fR" 4 .IX Item "$acl->who_am_i" Returns the WebID of the agent that \s-1ACL\s0 is acting like (if any). .ie n .IP """$acl\->save($format, $filename)""" 4 .el .IP "\f(CW$acl\->save($format, $filename)\fR" 4 .IX Item "$acl->save($format, $filename)" Serialises a local (not remote) \s-1ACL\s0. .Sp \&\f(CW$format\fR can be any format supported by the \f(CW\*(C`serialize\*(C'\fR function from RDF::TrineX::Functions. .Sp If \f(CW$filename\fR is provided, this method writes to the file and returns the new file size in bytes. .Sp If \f(CW$filename\fR is omitted, this method does not attempt to write to a file, and simply returns the string it would have written. .ie n .IP """$acl\->is_remote""" 4 .el .IP "\f(CW$acl\->is_remote\fR" 4 .IX Item "$acl->is_remote" Returns true if the \s-1ACL\s0 is remote; false if local. .ie n .IP """$acl\->is_mutable""" 4 .el .IP "\f(CW$acl\->is_mutable\fR" 4 .IX Item "$acl->is_mutable" Can this \s-1ACL\s0 be modified? .ie n .IP """$acl\->model""" 4 .el .IP "\f(CW$acl\->model\fR" 4 .IX Item "$acl->model" The graph model against which authorisation checks are made. .Sp Returned as an RDF::Trine::Model object. .ie n .IP """$acl\->endpoint""" 4 .el .IP "\f(CW$acl\->endpoint\fR" 4 .IX Item "$acl->endpoint" The endpoint \s-1URI\s0 for remote (non-local) \s-1ACL\s0 queries. .Sp Returned as a \s-1URI\s0 object. .SH "BUGS" .IX Header "BUGS" Please report any bugs to . .SH "SEE ALSO" .IX Header "SEE ALSO" Web::ID. .PP . .PP , http://lists.foaf\-project.org/mailman/listinfo/foaf\-protocols . .SH "AUTHOR" .IX Header "AUTHOR" Toby Inkster . .SH "COPYRIGHT AND LICENCE" .IX Header "COPYRIGHT AND LICENCE" This software is copyright (c) 2010\-2012 by Toby Inkster. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. .SH "DISCLAIMER OF WARRANTIES" .IX Header "DISCLAIMER OF WARRANTIES" \&\s-1THIS\s0 \s-1PACKAGE\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1AND\s0 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1EXPRESS\s0 \s-1OR\s0 \s-1IMPLIED\s0 \&\s-1WARRANTIES\s0, \s-1INCLUDING\s0, \s-1WITHOUT\s0 \s-1LIMITATION\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0 \&\s-1MERCHANTIBILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0.