mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-13 07:32:13 +00:00
SEC-150: Expand exception message.
This commit is contained in:
parent
6cf30c71b8
commit
f4c1b81a9c
@ -1,4 +1,4 @@
|
|||||||
/* Copyright 2004, 2005 Acegi Technology Pty Limited
|
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -103,110 +103,6 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|||||||
|
|
||||||
//~ Methods ================================================================
|
//~ Methods ================================================================
|
||||||
|
|
||||||
public void setAclObjectIdentityDelete(
|
|
||||||
AclObjectIdentityDelete aclObjectIdentityDelete) {
|
|
||||||
this.aclObjectIdentityDelete = aclObjectIdentityDelete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AclObjectIdentityDelete getAclObjectIdentityDelete() {
|
|
||||||
return aclObjectIdentityDelete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAclObjectIdentityDeleteStatement(
|
|
||||||
String aclObjectIdentityDeleteStatement) {
|
|
||||||
this.aclObjectIdentityDeleteStatement = aclObjectIdentityDeleteStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAclObjectIdentityDeleteStatement() {
|
|
||||||
return aclObjectIdentityDeleteStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAclObjectIdentityInsert(
|
|
||||||
AclObjectIdentityInsert aclObjectIdentityInsert) {
|
|
||||||
this.aclObjectIdentityInsert = aclObjectIdentityInsert;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AclObjectIdentityInsert getAclObjectIdentityInsert() {
|
|
||||||
return aclObjectIdentityInsert;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAclObjectIdentityInsertStatement(
|
|
||||||
String aclObjectIdentityInsertStatement) {
|
|
||||||
this.aclObjectIdentityInsertStatement = aclObjectIdentityInsertStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAclObjectIdentityInsertStatement() {
|
|
||||||
return aclObjectIdentityInsertStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAclPermissionDelete(AclPermissionDelete aclPermissionDelete) {
|
|
||||||
this.aclPermissionDelete = aclPermissionDelete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AclPermissionDelete getAclPermissionDelete() {
|
|
||||||
return aclPermissionDelete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAclPermissionDeleteStatement(
|
|
||||||
String aclPermissionDeleteStatement) {
|
|
||||||
this.aclPermissionDeleteStatement = aclPermissionDeleteStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAclPermissionDeleteStatement() {
|
|
||||||
return aclPermissionDeleteStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAclPermissionInsert(AclPermissionInsert aclPermissionInsert) {
|
|
||||||
this.aclPermissionInsert = aclPermissionInsert;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AclPermissionInsert getAclPermissionInsert() {
|
|
||||||
return aclPermissionInsert;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAclPermissionInsertStatement(
|
|
||||||
String aclPermissionInsertStatement) {
|
|
||||||
this.aclPermissionInsertStatement = aclPermissionInsertStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAclPermissionInsertStatement() {
|
|
||||||
return aclPermissionInsertStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAclPermissionUpdate(AclPermissionUpdate aclPermissionUpdate) {
|
|
||||||
this.aclPermissionUpdate = aclPermissionUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AclPermissionUpdate getAclPermissionUpdate() {
|
|
||||||
return aclPermissionUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAclPermissionUpdateStatement(
|
|
||||||
String aclPermissionUpdateStatement) {
|
|
||||||
this.aclPermissionUpdateStatement = aclPermissionUpdateStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAclPermissionUpdateStatement() {
|
|
||||||
return aclPermissionUpdateStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLookupPermissionIdMapping(
|
|
||||||
MappingSqlQuery lookupPermissionIdMapping) {
|
|
||||||
this.lookupPermissionIdMapping = lookupPermissionIdMapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MappingSqlQuery getLookupPermissionIdMapping() {
|
|
||||||
return lookupPermissionIdMapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLookupPermissionIdQuery(String lookupPermissionIdQuery) {
|
|
||||||
this.lookupPermissionIdQuery = lookupPermissionIdQuery;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLookupPermissionIdQuery() {
|
|
||||||
return lookupPermissionIdQuery;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void changeMask(AclObjectIdentity aclObjectIdentity,
|
public void changeMask(AclObjectIdentity aclObjectIdentity,
|
||||||
Object recipient, Integer newMask) throws DataAccessException {
|
Object recipient, Integer newMask) throws DataAccessException {
|
||||||
// Retrieve acl_object_identity record details
|
// Retrieve acl_object_identity record details
|
||||||
@ -241,10 +137,14 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|||||||
.getAclObjectIdentity());
|
.getAclObjectIdentity());
|
||||||
|
|
||||||
// Ensure there isn't an existing record for this recipient
|
// Ensure there isn't an existing record for this recipient
|
||||||
if (lookupPermissionId(aclDetailsHolder.getForeignKeyId(),
|
long permissionId = lookupPermissionId(aclDetailsHolder.getForeignKeyId(),
|
||||||
basicAclEntry.getRecipient()) != -1) {
|
basicAclEntry.getRecipient());
|
||||||
throw new DataIntegrityViolationException(
|
|
||||||
"This recipient already exists for this aclObjectIdentity");
|
if (permissionId != -1) {
|
||||||
|
throw new DataIntegrityViolationException("Recipient '"
|
||||||
|
+ basicAclEntry.getRecipient()
|
||||||
|
+ "' already exists for aclObjectIdentity ID "
|
||||||
|
+ aclDetailsHolder.getForeignKeyId() + " (permission ID " + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create acl_permission
|
// Create acl_permission
|
||||||
@ -253,46 +153,6 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|||||||
new Integer(basicAclEntry.getMask()));
|
new Integer(basicAclEntry.getMask()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(AclObjectIdentity aclObjectIdentity)
|
|
||||||
throws DataAccessException {
|
|
||||||
// Retrieve acl_object_identity record details
|
|
||||||
AclDetailsHolder aclDetailsHolder = lookupAclDetailsHolder(aclObjectIdentity);
|
|
||||||
|
|
||||||
// Retrieve all acl_permissions applying to this acl_object_identity
|
|
||||||
Iterator acls = aclsByObjectIdentity.execute(aclDetailsHolder
|
|
||||||
.getForeignKeyId()).iterator();
|
|
||||||
|
|
||||||
// Delete all existing acl_permissions applying to this acl_object_identity
|
|
||||||
while (acls.hasNext()) {
|
|
||||||
AclDetailsHolder permission = (AclDetailsHolder) acls.next();
|
|
||||||
delete(aclObjectIdentity, permission.getRecipient());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete acl_object_identity
|
|
||||||
aclObjectIdentityDelete.delete(new Long(
|
|
||||||
aclDetailsHolder.getForeignKeyId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void delete(AclObjectIdentity aclObjectIdentity, Object recipient)
|
|
||||||
throws DataAccessException {
|
|
||||||
// Retrieve acl_object_identity record details
|
|
||||||
AclDetailsHolder aclDetailsHolder = lookupAclDetailsHolder(aclObjectIdentity);
|
|
||||||
|
|
||||||
// Delete acl_permission
|
|
||||||
aclPermissionDelete.delete(new Long(aclDetailsHolder.getForeignKeyId()),
|
|
||||||
recipient.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void initDao() throws ApplicationContextException {
|
|
||||||
super.initDao();
|
|
||||||
lookupPermissionIdMapping = new LookupPermissionIdMapping(getDataSource());
|
|
||||||
aclPermissionInsert = new AclPermissionInsert(getDataSource());
|
|
||||||
aclObjectIdentityInsert = new AclObjectIdentityInsert(getDataSource());
|
|
||||||
aclPermissionDelete = new AclPermissionDelete(getDataSource());
|
|
||||||
aclObjectIdentityDelete = new AclObjectIdentityDelete(getDataSource());
|
|
||||||
aclPermissionUpdate = new AclPermissionUpdate(getDataSource());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method that creates an acl_object_identity record if
|
* Convenience method that creates an acl_object_identity record if
|
||||||
* required.
|
* required.
|
||||||
@ -327,6 +187,94 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delete(AclObjectIdentity aclObjectIdentity)
|
||||||
|
throws DataAccessException {
|
||||||
|
// Retrieve acl_object_identity record details
|
||||||
|
AclDetailsHolder aclDetailsHolder = lookupAclDetailsHolder(aclObjectIdentity);
|
||||||
|
|
||||||
|
// Retrieve all acl_permissions applying to this acl_object_identity
|
||||||
|
Iterator acls = aclsByObjectIdentity.execute(aclDetailsHolder
|
||||||
|
.getForeignKeyId()).iterator();
|
||||||
|
|
||||||
|
// Delete all existing acl_permissions applying to this acl_object_identity
|
||||||
|
while (acls.hasNext()) {
|
||||||
|
AclDetailsHolder permission = (AclDetailsHolder) acls.next();
|
||||||
|
delete(aclObjectIdentity, permission.getRecipient());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete acl_object_identity
|
||||||
|
aclObjectIdentityDelete.delete(new Long(
|
||||||
|
aclDetailsHolder.getForeignKeyId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(AclObjectIdentity aclObjectIdentity, Object recipient)
|
||||||
|
throws DataAccessException {
|
||||||
|
// Retrieve acl_object_identity record details
|
||||||
|
AclDetailsHolder aclDetailsHolder = lookupAclDetailsHolder(aclObjectIdentity);
|
||||||
|
|
||||||
|
// Delete acl_permission
|
||||||
|
aclPermissionDelete.delete(new Long(aclDetailsHolder.getForeignKeyId()),
|
||||||
|
recipient.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public AclObjectIdentityDelete getAclObjectIdentityDelete() {
|
||||||
|
return aclObjectIdentityDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAclObjectIdentityDeleteStatement() {
|
||||||
|
return aclObjectIdentityDeleteStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AclObjectIdentityInsert getAclObjectIdentityInsert() {
|
||||||
|
return aclObjectIdentityInsert;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAclObjectIdentityInsertStatement() {
|
||||||
|
return aclObjectIdentityInsertStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AclPermissionDelete getAclPermissionDelete() {
|
||||||
|
return aclPermissionDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAclPermissionDeleteStatement() {
|
||||||
|
return aclPermissionDeleteStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AclPermissionInsert getAclPermissionInsert() {
|
||||||
|
return aclPermissionInsert;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAclPermissionInsertStatement() {
|
||||||
|
return aclPermissionInsertStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AclPermissionUpdate getAclPermissionUpdate() {
|
||||||
|
return aclPermissionUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAclPermissionUpdateStatement() {
|
||||||
|
return aclPermissionUpdateStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingSqlQuery getLookupPermissionIdMapping() {
|
||||||
|
return lookupPermissionIdMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLookupPermissionIdQuery() {
|
||||||
|
return lookupPermissionIdQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initDao() throws ApplicationContextException {
|
||||||
|
super.initDao();
|
||||||
|
lookupPermissionIdMapping = new LookupPermissionIdMapping(getDataSource());
|
||||||
|
aclPermissionInsert = new AclPermissionInsert(getDataSource());
|
||||||
|
aclObjectIdentityInsert = new AclObjectIdentityInsert(getDataSource());
|
||||||
|
aclPermissionDelete = new AclPermissionDelete(getDataSource());
|
||||||
|
aclObjectIdentityDelete = new AclObjectIdentityDelete(getDataSource());
|
||||||
|
aclPermissionUpdate = new AclPermissionUpdate(getDataSource());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method that obtains a given acl_object_identity record.
|
* Convenience method that obtains a given acl_object_identity record.
|
||||||
*
|
*
|
||||||
@ -376,6 +324,62 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|||||||
return ((Long) list.get(0)).longValue();
|
return ((Long) list.get(0)).longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAclObjectIdentityDelete(
|
||||||
|
AclObjectIdentityDelete aclObjectIdentityDelete) {
|
||||||
|
this.aclObjectIdentityDelete = aclObjectIdentityDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAclObjectIdentityDeleteStatement(
|
||||||
|
String aclObjectIdentityDeleteStatement) {
|
||||||
|
this.aclObjectIdentityDeleteStatement = aclObjectIdentityDeleteStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAclObjectIdentityInsert(
|
||||||
|
AclObjectIdentityInsert aclObjectIdentityInsert) {
|
||||||
|
this.aclObjectIdentityInsert = aclObjectIdentityInsert;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAclObjectIdentityInsertStatement(
|
||||||
|
String aclObjectIdentityInsertStatement) {
|
||||||
|
this.aclObjectIdentityInsertStatement = aclObjectIdentityInsertStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAclPermissionDelete(AclPermissionDelete aclPermissionDelete) {
|
||||||
|
this.aclPermissionDelete = aclPermissionDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAclPermissionDeleteStatement(
|
||||||
|
String aclPermissionDeleteStatement) {
|
||||||
|
this.aclPermissionDeleteStatement = aclPermissionDeleteStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAclPermissionInsert(AclPermissionInsert aclPermissionInsert) {
|
||||||
|
this.aclPermissionInsert = aclPermissionInsert;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAclPermissionInsertStatement(
|
||||||
|
String aclPermissionInsertStatement) {
|
||||||
|
this.aclPermissionInsertStatement = aclPermissionInsertStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAclPermissionUpdate(AclPermissionUpdate aclPermissionUpdate) {
|
||||||
|
this.aclPermissionUpdate = aclPermissionUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAclPermissionUpdateStatement(
|
||||||
|
String aclPermissionUpdateStatement) {
|
||||||
|
this.aclPermissionUpdateStatement = aclPermissionUpdateStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLookupPermissionIdMapping(
|
||||||
|
MappingSqlQuery lookupPermissionIdMapping) {
|
||||||
|
this.lookupPermissionIdMapping = lookupPermissionIdMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLookupPermissionIdQuery(String lookupPermissionIdQuery) {
|
||||||
|
this.lookupPermissionIdQuery = lookupPermissionIdQuery;
|
||||||
|
}
|
||||||
|
|
||||||
//~ Inner Classes ==========================================================
|
//~ Inner Classes ==========================================================
|
||||||
|
|
||||||
protected class AclObjectIdentityDelete extends SqlUpdate {
|
protected class AclObjectIdentityDelete extends SqlUpdate {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user