You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by bu...@apache.org on 2005/04/07 08:47:31 UTC
DO NOT REPLY [Bug 34343] New: -
revokePermission in PostgresRDBMSAdapter.java doesn't work
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34343>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=34343
Summary: revokePermission in PostgresRDBMSAdapter.java doesn't
work
Product: Slide
Version: Nightly
Platform: All
OS/Version: All
Status: NEW
Keywords: PatchAvailable
Severity: normal
Priority: P2
Component: Stores
AssignedTo: slide-dev@jakarta.apache.org
ReportedBy: tomekem@poczta.fm
File: PostgresRDBMSAdapter.java
Method: public void revokePermission(Connection connection, Uri uri,
NodePermission permission) throws ServiceAccessException
This method doesn't work. Query is wrong and is crashing on PostgreSQL 8.0.
I changed query to:
try {
NodeRevisionNumber revisionNumber =
permission.getRevisionNumber();
if (revisionNumber == null)
statement = connection.prepareStatement(
"delete from PERMISSIONS where
(OBJECT_ID, SUBJECT_ID, ACTION_ID) IN ( SELECT ou.URI_ID, su.URI_ID, au.URI_ID
FROM URI ou, URI su, URI au WHERE ou.URI_STRING = ? and su.URI_STRING = ? and
au.URI_STRING = ?) and VERSION_NO IS NULL");
else
statement = connection.prepareStatement(
"delete from PERMISSIONS where
(OBJECT_ID, SUBJECT_ID, ACTION_ID) IN ( SELECT ou.URI_ID, su.URI_ID, au.URI_ID
FROM URI ou, URI su, URI au WHERE ou.URI_STRING = ? and su.URI_STRING = ? and
au.URI_STRING = ?) and VERSION_NO = ?");
statement.setString(1, permission.getObjectUri());
statement.setString(2, permission.getSubjectUri());
statement.setString(3, permission.getActionUri());
if (revisionNumber != null)
statement.setString(4, revisionNumber.toString());
statement.executeUpdate();
Then it seems to work fine.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
Re: DO NOT REPLY [Bug 34343] New: - revokePermission in PostgresRDBMSAdapter.java
doesn't work
Posted by Martin Kalén <mk...@apache.org>.
bugzilla@apache.org wrote:
> if (revisionNumber == null)
> statement = connection.prepareStatement(
> "delete from PERMISSIONS where
> (OBJECT_ID, SUBJECT_ID, ACTION_ID) IN ( SELECT ou.URI_ID, su.URI_ID, au.URI_ID
> FROM URI ou, URI su, URI au WHERE ou.URI_STRING = ? and su.URI_STRING = ? and
> au.URI_STRING = ?) and VERSION_NO IS NULL");
> else
> statement = connection.prepareStatement(
> "delete from PERMISSIONS where
> (OBJECT_ID, SUBJECT_ID, ACTION_ID) IN ( SELECT ou.URI_ID, su.URI_ID, au.URI_ID
> FROM URI ou, URI su, URI au WHERE ou.URI_STRING = ? and su.URI_STRING = ? and
> au.URI_STRING = ?) and VERSION_NO = ?");
...which reminds me that the method used in CommonRDBMSAdapter, although
fixed since yesterday, is not very clever re PreparedStatement as it uses
a hardcoded revision number as parameter #4.
Eg suffix "and VERSION_NO = 1.0" vs "and VERSION_NO = 1.1" makes the statements
non-reusable although they are PreparedStatements.
My previous patch for CommonRDBMSAdapter sholud be adjusted in a similar fashion
as the PostgreSQL adapter above.
Regards,
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org