The URI Shortener Service "curi" can make optional use of VAL for login and ACL support.
If VAL is installed the URI Shortener Service will show a login link along with information about the currently authenticated user. By default ACLs are disabled which means that anyone can create and read compressed URIs.
http://www.openlinksw.com/ontology/acl#DefaultRealm
and default hostname "HOST"
the graph IRI would be http://HOST/acl/graph/rules/http%3A%2F%2Fwww.openlinksw.com%2Fontology%2Facl%23DefaultRealm
and the groups will be stored in named graph http://HOST/acl/graph/groups/http%3A%2F%2Fwww.openlinksw.com%2Fontology%2Facl%23DefaultRealm
.
Be aware that these graphs can be customized for better readability.
VAL controls ACL application through ACL scopes which can be enabled and disabled per application realm. Thus, in order to enable curi ACLs in the default realm the following can be done:
sparql prefix oplacl: <http://www.openlinksw.com/ontology/acl#> with <urn:virtuoso:val:config> delete { oplacl:DefaultRealm oplacl:hasDisabledAclScope <urn:virtuoso:val:scopes:curi> . } insert { oplacl:DefaultRealm oplacl:hasEnabledAclScope <urn:virtuoso:val:scopes:curi> . };
Curi allows to control both the creation and the reading of compressed URIs via ACL.
The resource URI is the URL of the Curi page itself, typically something like http://host.com/c
.
The ACL scope is as could be seen above urn:virtuoso:val:scopes:curi
.
Be aware that the ACL graphs can be customized for better readability.
sparql prefix oplacl: <http://www.openlinksw.com/ontology/acl#> prefix acl: <http://www.w3.org/ns/auth/acl#> prefix foaf: <http://xmlns.com/foaf/0.1/> with <http://HOST/acl/graph/rules/http%3A%2F%2Fwww.openlinksw.com%2Fontology%2Facl%23DefaultRealm> insert { <#rule> a acl:Authorization ; oplacl:hasAccessMode oplacl:Read ; acl:accessTo <http://HOST/c> ; acl:agentClass foaf:Agent ; oplacl:hasScope <urn:virtuoso:val:scopes:curi> ; oplacl:hasRealm oplacl:DefaultRealm . };
Typically this rule should be created using the ACL API (internal API or RESTful API)
(When manually creating ACL rules without the help of the API, then the realm need to be specified via oplacl:hasRealm
and the rule needs to be added into the corresponding graph.
In the case of the default application realm this would be http://HOST/acl/graph/rules/http%3A%2F%2Fwww.openlinksw.com%2Fontology%2Facl%23DefaultRealm
.)
sparql prefix oplacl: <http://www.openlinksw.com/ontology/acl#> prefix foaf: <http://xmlns.com/foaf/0.1/> with <http://HOST/acl/graph/groups/http%3A%2F%2Fwww.openlinksw.com%2Fontology%2Facl%23DefaultRealm> insert { <#group> a oplacl:ConditionalGroup ; foaf:name "Valid Identifiers" ; oplacl:hasCondition [ a oplacl:GroupCondition, oplacl:GenericCondition ; oplacl:hasCriteria oplacl:NetID ; oplacl:hasComparator oplacl:IsNotNull ; oplacl:hasValue 1 ] . };
(When manually creating groups without the help of the API, then the group needs to be added into the corresponding graph.
In the case of the default application realm this would be http://HOST/acl/graph/groups/http%3A%2F%2Fwww.openlinksw.com%2Fontology%2Facl%23DefaultRealm
.)
This group can then be used in an ACL rule as follows:
sparql prefix oplacl: <http://www.openlinksw.com/ontology/acl#> prefix acl: <http://www.w3.org/ns/auth/acl#> prefix foaf: <http://xmlns.com/foaf/0.1/> with <http://HOST/acl/graph/rules/http%3A%2F%2Fwww.openlinksw.com%2Fontology%2Facl%23DefaultRealm> insert { <#rule> a acl:Authorization ; oplacl:hasAccessMode oplacl:Write ; acl:accessTo <http://HOST/c> ; acl:agent <#group> ; oplacl:hasScope <urn:virtuoso:val:scopes:curi> ; oplacl:hasRealm oplacl:DefaultRealm .
Like all applications using VAL's authentication pages curi can make use of VAL's request for access feature which allows to easily send a message to the owner of the resource asking for permission to use it.
All VAL requires to know is who owns the resource. This is easily done by using the VAL API. If, for example, "dba" should be the owner of the curi service, then the following call will save that fact:
VAL.DBA.set_resource_ownership ( scope=>'urn:virtuoso:val:scopes:curi', resource=>'http://HOST/c', serviceId=>VAL.DBA.user_personal_uri ('dba') );
This call will add a triple like the following into a private graph which is then added to a graph group containing all ownership graphs for the given scope:
@prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://HOST/dataspace/person/dba#this> foaf:made <urn:virtuoso:access:curi> .