org.openrdf.sesame.omm
Interface SecurityServices

All Known Implementing Classes:
SecuritySail

public interface SecurityServices

Security Services inteface. That inteface holds all external methods to manage users and groups for the repository. This includes user authenication, basic users management, and basic group managemenet methods. Manipulation of a patricular user or group is made via more specific interfaces that can be retrieved through this one. This interface also provides import and export of the security setup from/to RDF.


Method Summary
 void addUser(int id, String login, String password, String name)
          Adds an new user.
 Restriction createRestriction(int id, int type, String name, String description)
          Creates a new restriction.
 Role createRole(int id, String name, String desctiption, Set parentRoles)
          Creates a new Role in the repository.
 void exportPolicy(RdfRepository repos)
          Exports the Security Policy to a Sail.
 Resource getResource(int id)
          Gets a resource given its id
 int getResourceId(Resource res)
          Gets the id associated with a resource.
 Restriction getRestriction(int id)
          Gets restriction by id.
 Role getRole(int id)
          Gets the role given its id.
 Role getRole(String name)
          Gets the role given its name.
 Set getRoles()
          Retrive a set of the roles' ids.
 User getUser(int id)
          Gets a user, given it's id
 User getUser(String login)
          Retrieves a interface to an object that supports the User interface.
 Set getUsers()
          Retrieves a set of the users in the repository.
 void importPolicy(Graph graph)
          Imports the security policy given an RDF Graph.
 boolean isRepositoryAccessible(Right right)
          Checks the accessibility of a repository for a specified right.
 boolean isResourceAccessible(Resource res)
          Checks the accessibility of a resource according the security policy and the existence of a Read right over the resource.
 boolean isSchemaAccessible(Right right)
          Checks the accessibility of a tracking for a specified right.
 boolean isStatementAccessible(Resource subj, URI pred, Value obj, Right right)
          Checks the accessibility of a statement according the security policy and a given right.
 boolean isStatementAccessible(Statement st, Right right)
          Checks the accessibility of a statement according the security policy and a given right.
 boolean isValueAccessible(Value val)
          Checks the accessibility of a value according to the security policy.
 boolean isVersionTrackingAccessible()
          Checks if the user has access to the versioning and tracking sail.
 void removeRole(int id)
          Removes user role from the repository.
 void removeRole(String name)
          Remove user role from the repository.
 void removeUser(String login)
          Removes a user given its login.
 

Method Detail

addUser

public void addUser(int id,
                    String login,
                    String password,
                    String name)
Adds an new user.

Parameters:
id - user's id
login - user's login
password - user's password
name - user's name

removeUser

public void removeUser(String login)
Removes a user given its login.

Parameters:
login - the login of the user to be removed.

getUsers

public Set getUsers()
Retrieves a set of the users in the repository. Each element of the list is a String containing the user's login.

Returns:
set of the users logins.

getUser

public User getUser(String login)
Retrieves a interface to an object that supports the User interface.

Parameters:
login - the user's login
Returns:
the user object represented by the param login, or null if no such user login.

getUser

public User getUser(int id)
Gets a user, given it's id

Parameters:
id - the user's id
Returns:
the user object represented by the param id, or null if no such user id.

createRole

public Role createRole(int id,
                       String name,
                       String desctiption,
                       Set parentRoles)
Creates a new Role in the repository.

Parameters:
id - the id of the role
name - the name of the role to be created
desctiption - the desctiption of the role to be created
parentRoles - Set of parent roles to inherit permissions from.
Returns:
the created Role

removeRole

public void removeRole(String name)
Remove user role from the repository.

Parameters:
name - the name of the role to be removed

removeRole

public void removeRole(int id)
Removes user role from the repository.

Parameters:
id - the id of the role to be removed

getRoles

public Set getRoles()
Retrive a set of the roles' ids.

Returns:
set of the roles' ids

getRole

public Role getRole(String name)
Gets the role given its name.

Parameters:
name - the name of the role.
Returns:
the role that corresponds to the given name, or null if there is no such known name.

getRole

public Role getRole(int id)
Gets the role given its id.

Parameters:
id - the id of the role.
Returns:
the role that corresponds to the given id, or null if there is no such known id.

createRestriction

public Restriction createRestriction(int id,
                                     int type,
                                     String name,
                                     String description)
                              throws NullParameterException
Creates a new restriction.

Parameters:
id -
type - type of the restriction
name -
description -
Returns:
the creaed restriction
Throws:
NullParameterException - if a parameter is null.

getRestriction

public Restriction getRestriction(int id)
Gets restriction by id.

Parameters:
id -
Returns:
the restriction corresponding to the given id.

isResourceAccessible

public boolean isResourceAccessible(Resource res)
Checks the accessibility of a resource according the security policy and the existence of a Read right over the resource.

Parameters:
res - the resource
Returns:
true if the resource is accessible, otherwise - false.

isStatementAccessible

public boolean isStatementAccessible(Statement st,
                                     Right right)
Checks the accessibility of a statement according the security policy and a given right.

Parameters:
st - The statement.
right - the right which is being checked for this statement
Returns:
true if the statement is accessible with the given right, otherwise - false.

isStatementAccessible

public boolean isStatementAccessible(Resource subj,
                                     URI pred,
                                     Value obj,
                                     Right right)
Checks the accessibility of a statement according the security policy and a given right.

Parameters:
subj - the subject of the statement
pred - the predicate of the statement
obj - the object of the statement
right - the right which is being checked for this statement
Returns:
true if the statement is accessible with the given right, otherwise - false.

isValueAccessible

public boolean isValueAccessible(Value val)
Checks the accessibility of a value according to the security policy.

Parameters:
val - the value to be checked
Returns:
true if the value is accessible through a read right, otherwise - false

isRepositoryAccessible

public boolean isRepositoryAccessible(Right right)
Checks the accessibility of a repository for a specified right.

Parameters:
right - the right to be checked
Returns:
true if the repository is accessible with the given right, otherwise - false.

isSchemaAccessible

public boolean isSchemaAccessible(Right right)
Checks the accessibility of a tracking for a specified right.

Parameters:
right - the right to be checked
Returns:
true if the schema is accessible with the given right, otherwise - false.

isVersionTrackingAccessible

public boolean isVersionTrackingAccessible()
Checks if the user has access to the versioning and tracking sail.

Returns:
true if the user has assiogned rule with a repository restriction and history right set to true, otherwise - false.

getResourceId

public int getResourceId(Resource res)
                  throws SecurityException
Gets the id associated with a resource.

Parameters:
res - a resource
Returns:
the id of the resource, if found
Throws:
SecurityException - if something goes wrong with the execution of the method

getResource

public Resource getResource(int id)
Gets a resource given its id

Parameters:
id - the id of the resource
Returns:
the resource with the specified id

exportPolicy

public void exportPolicy(RdfRepository repos)
Exports the Security Policy to a Sail. To be used with an In-Memory sail for example (org.openrdf.sesame.sail.memory.list.RdfRepository).

Parameters:
repos - the RdfRepository to export to

importPolicy

public void importPolicy(Graph graph)
Imports the security policy given an RDF Graph.

Parameters:
graph - the Graph to read the security policy from


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.