org.eaglei.repository.model
Class AccessGrant

java.lang.Object
  extended by org.eaglei.repository.model.AccessGrant

public class AccessGrant
extends java.lang.Object

Record class describing one "grant" of access to an entity in the repository. Also includes utility methods to manage grants. Started April, 2010

Version:
$Id: $
Author:
Larry Stone

Method Summary
static void addGrant(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI instance, org.openrdf.model.URI agent, org.openrdf.model.URI access)
          Add the specified grant to the instance.
static void addGrantAsAdministrator(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI instance, org.openrdf.model.URI agent, org.openrdf.model.URI access)
          Add the specified grant to the instance, but WITHOUT cehcking for ADMIN access.
static java.lang.Iterable<org.openrdf.model.Statement> exportGrants(org.openrdf.model.URI uri, java.lang.Iterable<AccessGrant> grants)
          Translate internal grant objects into exportable statements on a given subject.
 java.lang.String getAccessLabel()
          consolidated getter
 org.openrdf.model.URI getAccessURI()
          consolidated getter
 java.lang.String getAgentLabel()
          consolidated getter
 java.lang.String getAgentTypeLabel()
          consolidated getter
 org.openrdf.model.URI getAgentTypeURI()
          consolidated getter
 org.openrdf.model.URI getAgentURI()
          consolidated getter
static java.lang.Iterable<AccessGrant> getGrants(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI uri)
           
static java.lang.Iterable<AccessGrant> getMyGrants(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI uri)
           
static java.lang.Iterable<org.openrdf.model.Statement> importGrants(javax.servlet.http.HttpServletRequest request, org.openrdf.repository.RepositoryConnection content, org.openrdf.model.URI oldURI, org.openrdf.model.URI newURI)
          Get importable access grant statements for URI from import document.
static boolean removeGrant(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI instance, org.openrdf.model.URI agent, org.openrdf.model.URI access)
          Remove specified grant of access from an instance.
static boolean removeGrantAsAdministrator(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI instance, org.openrdf.model.URI agent, org.openrdf.model.URI access)
          Remove specified grant of access from a URI, but WITHOUT cehcking for ADMIN access.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAccessURI

public org.openrdf.model.URI getAccessURI()
consolidated getter


getAccessLabel

public java.lang.String getAccessLabel()
consolidated getter


getAgentURI

public org.openrdf.model.URI getAgentURI()
consolidated getter


getAgentLabel

public java.lang.String getAgentLabel()
consolidated getter


getAgentTypeURI

public org.openrdf.model.URI getAgentTypeURI()
consolidated getter


getAgentTypeLabel

public java.lang.String getAgentTypeLabel()
consolidated getter


removeGrant

public static boolean removeGrant(javax.servlet.http.HttpServletRequest request,
                                  org.openrdf.model.URI instance,
                                  org.openrdf.model.URI agent,
                                  org.openrdf.model.URI access)
Remove specified grant of access from an instance. Returns true if grant was there, false if not. WARNING: You will need to commit() these changes to the repo connection!

Parameters:
request - a HttpServletRequest object.
instance - subject from which to remove access grant a URI object.
agent - principal to whom the access was granted, a URI object.
access - type of access, a URI object.
Returns:
a boolean, true if there was a grant to be removed.

removeGrantAsAdministrator

public static boolean removeGrantAsAdministrator(javax.servlet.http.HttpServletRequest request,
                                                 org.openrdf.model.URI instance,
                                                 org.openrdf.model.URI agent,
                                                 org.openrdf.model.URI access)
Remove specified grant of access from a URI, but WITHOUT cehcking for ADMIN access. This is meant for INTERNAL user where the program logic mediates access, e.g. workflow. Returns true if grant was there, false if not. WARNING: You will need to commit() these changes to the repo connection!

Parameters:
request - a HttpServletRequest object.
instance - subject from which to remove access grant a URI object.
agent - principal to whom the access was granted, a URI object.
access - type of access, a URI object.
Returns:
a boolean, true if there was a grant to be removed.

addGrant

public static void addGrant(javax.servlet.http.HttpServletRequest request,
                            org.openrdf.model.URI instance,
                            org.openrdf.model.URI agent,
                            org.openrdf.model.URI access)
Add the specified grant to the instance. Requires ADMIN access. WARNING: You will need to commit() these changes to the repo connection!

Parameters:
request - a HttpServletRequest object.
instance - subject from which to add access grant a URI object.
agent - principal to whom the access was granted, a URI object.
access - type of access, a URI object.

addGrantAsAdministrator

public static void addGrantAsAdministrator(javax.servlet.http.HttpServletRequest request,
                                           org.openrdf.model.URI instance,
                                           org.openrdf.model.URI agent,
                                           org.openrdf.model.URI access)
Add the specified grant to the instance, but WITHOUT cehcking for ADMIN access. This is meant for INTERNAL user where the program logic mediates access, e.g. workflow. WARNING: You will need to commit() these changes to the repo connection!

Parameters:
request - a HttpServletRequest object.
instance - subject from which to add access grant a URI object.
agent - principal to whom the access was granted, a URI object.
access - type of access, a URI object.

getGrants

public static java.lang.Iterable<AccessGrant> getGrants(javax.servlet.http.HttpServletRequest request,
                                                        org.openrdf.model.URI uri)

getMyGrants

public static java.lang.Iterable<AccessGrant> getMyGrants(javax.servlet.http.HttpServletRequest request,
                                                          org.openrdf.model.URI uri)

exportGrants

public static java.lang.Iterable<org.openrdf.model.Statement> exportGrants(org.openrdf.model.URI uri,
                                                                           java.lang.Iterable<AccessGrant> grants)
Translate internal grant objects into exportable statements on a given subject.

Parameters:
uri - - the subject
grants - - grant objects
Returns:
iterable list of Sesame Statement objects

importGrants

public static java.lang.Iterable<org.openrdf.model.Statement> importGrants(javax.servlet.http.HttpServletRequest request,
                                                                           org.openrdf.repository.RepositoryConnection content,
                                                                           org.openrdf.model.URI oldURI,
                                                                           org.openrdf.model.URI newURI)
Get importable access grant statements for URI from import document. NOTE that it looks up grants on oldURI, but puts newURI in the new grant statements; this is in case subject URI got transformed on the import. Also note that source grants come from 'content' (could be a memory repo) but we need still the regular repo to compute ACL query the first time.



Copyright © 2009-2011 Eagle-I. All Rights Reserved.