Search in sources :

Example 6 with DatabasePermission

use of org.apache.derby.security.DatabasePermission in project derby by apache.

the class SystemPrivilegesPermissionTest method createDBPermNoCheck.

/**
 * Create a DatabasePermission object without checking that the URL
 * and the actions are valid.
 *
 * @param url the URL of the permission
 * @param actions the actions of the permission
 * @return a DatabasePermission instance
 */
private static DatabasePermission createDBPermNoCheck(String url, String actions) throws IOException {
    // First create a valid permission object, so that the checks in
    // the constructor are happy.
    DatabasePermission perm = new DatabasePermission("directory:dir", "create");
    // Then use reflection to override the values of the fields with
    // potentially invalid values.
    setField(Permission.class, "name", perm, url);
    setField(DatabasePermission.class, "actions", perm, actions);
    return perm;
}
Also used : DatabasePermission(org.apache.derby.security.DatabasePermission)

Aggregations

DatabasePermission (org.apache.derby.security.DatabasePermission)6 IOException (java.io.IOException)1 AccessControlException (java.security.AccessControlException)1 Permission (java.security.Permission)1 PrivilegedActionException (java.security.PrivilegedActionException)1 SQLClientInfoException (java.sql.SQLClientInfoException)1 SQLException (java.sql.SQLException)1 SQLPermission (java.sql.SQLPermission)1 XAException (javax.transaction.xa.XAException)1 SystemPrincipal (org.apache.derby.authentication.SystemPrincipal)1 StandardException (org.apache.derby.shared.common.error.StandardException)1