Cannot Save Individual Permissions on Structures (MSSQL ONLY)
To reproduce:
- Bring up a new starter on an MSSQL db
- Login goto Structures Tab
- Edit a structure go to permissions tab
- Permission Individually and add a role
- Give the role some permissions on the structure and save the permissions.
The error is eaten up by AJAX, but it is throwing a DotDataException. In my 2.2 codebase (I confirmed in master) the lines it was failing on were:
[14/01/13 17:11:49:283 GMT] ERROR ajax.PermissionAjax: Incorrect syntax near the keyword 'distinct'. com.dotmarketing.exception.DotDataException: Incorrect syntax near the keyword 'distinct'. at com.dotmarketing.common.db.DotConnect.loadResult(DotConnect.java:232) at com.dotmarketing.common.db.DotConnect.loadResults(DotConnect.java:345) at com.dotmarketing.business.PermissionBitFactoryImpl.updatePermissionReferencesOnAdd(PermissionBitFactoryImpl.java:1654) at com.dotmarketing.business.PermissionBitFactoryImpl.assignPermissions(PermissionBitFactoryImpl.java:1887) at com.dotmarketing.business.PermissionBitAPIImpl.assignPermissions(PermissionBitAPIImpl.java:595) at com.dotmarketing.business.ajax.PermissionAjax.saveAssetPermissions(PermissionAjax.java:270)
The SQL it is trying to execute is: select top 200 distinct contentlet.identifier as id from contentlet where contentlet.structure_inode = ?
A screencast reproducing the issue: http://screencast.com/t/usd0rvoDQ
dev information: this is a new feature in the DotConnect that is adding a limit
for the case of mssql it is a top xxx after select. But if it has a select distinct then it ends up as select top xxx distinct that is incorrect.
When fixed we should add this to our permissions unit tests.
fixed
See The Enterprise Ticket: http://jira.dotmarketing.net/browse/EE-5095 for a hotfix for 2.2
Working now on mssql... no errors in log