org.apache.derby.database
Class UserUtility

java.lang.Object
  extended byorg.apache.derby.database.UserUtility

public abstract class UserUtility
extends java.lang.Object

This utility class provides static methods for managing user authorization in a Cloudscape database.

This class can only be used within an SQL-J statement, a Java procedure or a server side Java method.

This class can be accessed using the class alias USERUTILITY in SQL-J statements.

IBM Corp. reserves the right to change, rename, or remove this interface at any time.


Field Summary
static java.lang.String FULL_ACCESS_PERMISSION
          Enumeration value for full access permission ("FULL_ACCESS_PERMISSION").
static java.lang.String READ_ACCESS_PERMISSION
          Enumeration value for read access permission ("READ_ACCESS_PERMISSION").
 
Constructor Summary
private UserUtility()
          Prevent users from creating UserUtility Objects.
 
Method Summary
static void add(java.lang.String userName, java.lang.String permission)
          Add a user's authorization permission to the database.
static void drop(java.lang.String userName)
          Drop a user's authorization permission from the database.
static java.lang.String getPermission(java.lang.String userName)
          Return a user's authorization permission in a database.
private static java.lang.String normalizeIdParam(java.lang.String pName, java.lang.String pValue)
           
static void set(java.lang.String userName, java.lang.String permission)
          Set the authorization permission for a user in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READ_ACCESS_PERMISSION

public static final java.lang.String READ_ACCESS_PERMISSION
Enumeration value for read access permission ("READ_ACCESS_PERMISSION").

See Also:
Constant Field Values

FULL_ACCESS_PERMISSION

public static final java.lang.String FULL_ACCESS_PERMISSION
Enumeration value for full access permission ("FULL_ACCESS_PERMISSION").

See Also:
Constant Field Values
Constructor Detail

UserUtility

private UserUtility()
Prevent users from creating UserUtility Objects.

Method Detail

add

public static final void add(java.lang.String userName,
                             java.lang.String permission)
                      throws java.sql.SQLException
Add a user's authorization permission to the database.

Only users with FULL_ACCESS_PERMISSION may use this.

Parameters:
userName - the user's name. A valid possibly delimited SQL identifier.
permission - READ_ACCESS_PERMISSION or FULL_ACCESS_PERMISSION.
Throws:
java.sql.SQLException - thrown if this fails.

set

public static final void set(java.lang.String userName,
                             java.lang.String permission)
                      throws java.sql.SQLException
Set the authorization permission for a user in the database.

Only users with FULL_ACCESS_PERMISSION may use this.

Parameters:
userName - the user's name. A valid possibly delimited SQL identifier.
permission - READ_ACCESS_PERMISSION or FULL_ACCESS_PERMISSION.
Throws:
java.sql.SQLException - thrown if this fails.

drop

public static final void drop(java.lang.String userName)
                       throws java.sql.SQLException
Drop a user's authorization permission from the database.

Only users with FULL_ACCESS_PERMISSION may use this.

Parameters:
userName - the user's name. A valid possibly delimited SQL identifier.
Returns:
if the user existed in the database and was dropped return true. If the user did not exist in the database to start with return false.
Throws:
java.sql.SQLException - thrown if this fails or the user being dropped does not exist.

getPermission

public static final java.lang.String getPermission(java.lang.String userName)
                                            throws java.sql.SQLException
Return a user's authorization permission in a database.

Users with FULL_ACCESS_PERMISSION or READ_ACCESS_PERMISSION may use this.

Parameters:
userName - the user's name. A valid possibly delimited SQL identifier.
Returns:
FULL_ACCESS_PERMISSION if the user is in "derby.database.fullAccessUsers", READ_ACCESS_PERMISSION if the user is in "derby.database.readOnlyAccessUsers", or null if the user is not in either list.
Throws:
java.sql.SQLException - thrown if this fails.

normalizeIdParam

private static java.lang.String normalizeIdParam(java.lang.String pName,
                                                 java.lang.String pValue)
                                          throws StandardException
Throws:
StandardException

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.