|
|
|
@ -116,8 +116,7 @@ public class JdbcMutableAclService extends JdbcAclService implements MutableAclS |
|
|
|
return acl.getEntries().size(); |
|
|
|
return acl.getEntries().size(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setValues(PreparedStatement stmt, int i) |
|
|
|
public void setValues(PreparedStatement stmt, int i) throws SQLException { |
|
|
|
throws SQLException { |
|
|
|
|
|
|
|
AccessControlEntry entry_ = acl.getEntries().get(i); |
|
|
|
AccessControlEntry entry_ = acl.getEntries().get(i); |
|
|
|
Assert.isTrue(entry_ instanceof AccessControlEntryImpl, "Unknown ACE class"); |
|
|
|
Assert.isTrue(entry_ instanceof AccessControlEntryImpl, "Unknown ACE class"); |
|
|
|
AccessControlEntryImpl entry = (AccessControlEntryImpl) entry_; |
|
|
|
AccessControlEntryImpl entry = (AccessControlEntryImpl) entry_; |
|
|
|
@ -187,28 +186,27 @@ public class JdbcMutableAclService extends JdbcAclService implements MutableAclS |
|
|
|
Assert.notNull(sid, "Sid required"); |
|
|
|
Assert.notNull(sid, "Sid required"); |
|
|
|
|
|
|
|
|
|
|
|
String sidName = null; |
|
|
|
String sidName = null; |
|
|
|
boolean principal = true; |
|
|
|
boolean sidIsPrincipal = true; |
|
|
|
|
|
|
|
|
|
|
|
if (sid instanceof PrincipalSid) { |
|
|
|
if (sid instanceof PrincipalSid) { |
|
|
|
sidName = ((PrincipalSid) sid).getPrincipal(); |
|
|
|
sidName = ((PrincipalSid) sid).getPrincipal(); |
|
|
|
} else if (sid instanceof GrantedAuthoritySid) { |
|
|
|
} else if (sid instanceof GrantedAuthoritySid) { |
|
|
|
sidName = ((GrantedAuthoritySid) sid).getGrantedAuthority(); |
|
|
|
sidName = ((GrantedAuthoritySid) sid).getGrantedAuthority(); |
|
|
|
principal = false; |
|
|
|
sidIsPrincipal = false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new IllegalArgumentException("Unsupported implementation of Sid"); |
|
|
|
throw new IllegalArgumentException("Unsupported implementation of Sid"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<Long> sidIds = jdbcTemplate.queryForList(selectSidPrimaryKey, |
|
|
|
List<Long> sidIds = jdbcTemplate.queryForList(selectSidPrimaryKey, |
|
|
|
new Object[] {new Boolean(principal), sidName}, Long.class); |
|
|
|
new Object[] {Boolean.valueOf(sidIsPrincipal), sidName}, Long.class); |
|
|
|
|
|
|
|
|
|
|
|
if (!sidIds.isEmpty()) { |
|
|
|
if (!sidIds.isEmpty()) { |
|
|
|
return sidIds.get(0); |
|
|
|
return sidIds.get(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (allowCreate) { |
|
|
|
if (allowCreate) { |
|
|
|
jdbcTemplate.update(insertSid, new Object[] {new Boolean(principal), sidName}); |
|
|
|
jdbcTemplate.update(insertSid, new Object[] {Boolean.valueOf(sidIsPrincipal), sidName}); |
|
|
|
Assert.isTrue(TransactionSynchronizationManager.isSynchronizationActive(), |
|
|
|
Assert.isTrue(TransactionSynchronizationManager.isSynchronizationActive(), "Transaction must be running"); |
|
|
|
"Transaction must be running"); |
|
|
|
|
|
|
|
return new Long(jdbcTemplate.queryForLong(sidIdentityQuery)); |
|
|
|
return new Long(jdbcTemplate.queryForLong(sidIdentityQuery)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|