Revision 6017
Added by ben leinfelder about 13 years ago
XMLAccessAccess.java | ||
---|---|---|
269 | 269 |
* permission order |
270 | 270 |
*/ |
271 | 271 |
public void addXMLAccess(String docId, String principalName, Long permission, String permType, |
272 |
String permOrder) throws AccessException, PermOrderException { |
|
272 |
String permOrder, String accessFileId, String subTreeId) throws AccessException, PermOrderException {
|
|
273 | 273 |
|
274 | 274 |
permOrderConflict(docId, permOrder); |
275 | 275 |
|
... | ... | |
280 | 280 |
// access type / access order combination, call cleanup to combine common access and then |
281 | 281 |
// re-retrieve the access list. |
282 | 282 |
if (xmlAccessList.size() == 0) { |
283 |
insertXMLAccess(docId, principalName, permission, permType, permOrder); |
|
283 |
insertXMLAccess(docId, principalName, permission, permType, permOrder, accessFileId, subTreeId);
|
|
284 | 284 |
return; |
285 | 285 |
} |
286 | 286 |
|
... | ... | |
322 | 322 |
// re-retrieve the access list. |
323 | 323 |
for(XMLAccessDAO xmlAccessDAO : xmlAccessList) { |
324 | 324 |
insertXMLAccess(docId, xmlAccessDAO.getPrincipalName(), xmlAccessDAO.getPermission(), |
325 |
xmlAccessDAO.getPermType(), xmlAccessDAO.getPermOrder()); |
|
325 |
xmlAccessDAO.getPermType(), xmlAccessDAO.getPermOrder(), xmlAccessDAO.getAccessFileId(), xmlAccessDAO.getSubTreeId());
|
|
326 | 326 |
} |
327 | 327 |
} |
328 | 328 |
|
... | ... | |
343 | 343 |
* permission order |
344 | 344 |
*/ |
345 | 345 |
private void insertXMLAccess(String docId, String principalName, Long permission, String permType, |
346 |
String permOrder) throws AccessException { |
|
346 |
String permOrder, String accessFileId, String subTreeId) throws AccessException {
|
|
347 | 347 |
//System.out.println("permission in insertXMLAccess: " + permission); |
348 | 348 |
try |
349 | 349 |
{ |
... | ... | |
387 | 387 |
serialNumber = conn.getCheckOutSerialNumber(); |
388 | 388 |
|
389 | 389 |
String sql = "INSERT INTO xml_access " + |
390 |
"(docid, principal_name, permission, perm_type, perm_order ) " + |
|
391 |
"VALUES (?,?,?,?,?)"; |
|
390 |
"(docid, principal_name, permission, perm_type, perm_order, accessfileid, subtreeid ) " +
|
|
391 |
"VALUES (?,?,?,?,?,?,?)";
|
|
392 | 392 |
pstmt = conn.prepareStatement(sql); |
393 | 393 |
|
394 | 394 |
// Bind the values to the query |
... | ... | |
397 | 397 |
pstmt.setLong(3, permission); |
398 | 398 |
pstmt.setString(4, permType); |
399 | 399 |
pstmt.setString(5, permOrder); |
400 |
pstmt.setString(6, accessFileId); |
|
401 |
pstmt.setString(7, subTreeId); |
|
400 | 402 |
|
401 | 403 |
String sqlReport = "XMLAccessAccess.insertXMLAccess - SQL: " + sql; |
402 | 404 |
sqlReport += " [" + docId + "," + principalName + "," + permission + "," + permType + "," + permOrder + "]"; |
... | ... | |
746 | 748 |
String principalName = null; |
747 | 749 |
String permType = null; |
748 | 750 |
String permOrder = null; |
751 |
// TODO: handle these fields |
|
752 |
String accessFileId = null; |
|
753 |
String subTreeId = null; |
|
749 | 754 |
|
750 | 755 |
|
751 | 756 |
// iterate through the list of access dao objects and bttwise or the permissions. Most |
... | ... | |
803 | 808 |
numDenyRecords++; |
804 | 809 |
denyPermissionMask |= xmlAccessDAO.getPermission(); |
805 | 810 |
} |
811 |
if (accessFileId == null) { |
|
812 |
accessFileId = xmlAccessDAO.getAccessFileId(); |
|
813 |
} |
|
814 |
if (subTreeId == null) { |
|
815 |
subTreeId = xmlAccessDAO.getSubTreeId(); |
|
816 |
} |
|
806 | 817 |
} |
807 | 818 |
|
808 | 819 |
// if there was more than one allow record, remove all allow records for this user on this doc |
809 | 820 |
// with this perm type and perm order then insert a single record |
810 | 821 |
if (numAllowRecords > 1) { |
811 | 822 |
deleteXMLAccessForPrincipal(docId, principalName, AccessControlInterface.ALLOW, permOrder); |
812 |
insertXMLAccess(docId, principalName, allowPermissionMask, AccessControlInterface.ALLOW, permOrder); |
|
823 |
insertXMLAccess(docId, principalName, allowPermissionMask, AccessControlInterface.ALLOW, permOrder, accessFileId, subTreeId);
|
|
813 | 824 |
} |
814 | 825 |
// if there was more than one deny record, remove all deny records for this user on this doc |
815 | 826 |
// with this perm type and perm order then insert a single record |
816 | 827 |
if (numDenyRecords > 1) { |
817 | 828 |
deleteXMLAccessForPrincipal(docId, principalName, AccessControlInterface.DENY, permOrder); |
818 |
insertXMLAccess(docId, principalName, denyPermissionMask, AccessControlInterface.DENY, permOrder); |
|
829 |
insertXMLAccess(docId, principalName, denyPermissionMask, AccessControlInterface.DENY, permOrder, accessFileId, subTreeId);
|
|
819 | 830 |
} |
820 | 831 |
} |
821 | 832 |
|
Also available in: Unified diff
include accessfileid and subtreeid when inserting xml_access values