core icon indicating copy to clipboard operation
core copied to clipboard

Cannot Save Individual Permissions on Structures (MSSQL ONLY)

Open cfalzone opened this issue 13 years ago • 5 comments

To reproduce:

  1. Bring up a new starter on an MSSQL db
  2. Login goto Structures Tab
  3. Edit a structure go to permissions tab
  4. Permission Individually and add a role
  5. 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

cfalzone avatar Jan 14 '13 18:01 cfalzone

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.

dotjorgeu avatar Jan 14 '13 18:01 dotjorgeu

When fixed we should add this to our permissions unit tests.

DeanGonzalez avatar Jan 14 '13 22:01 DeanGonzalez

fixed

ravit avatar Jan 15 '13 07:01 ravit

See The Enterprise Ticket: http://jira.dotmarketing.net/browse/EE-5095 for a hotfix for 2.2

cfalzone avatar Jan 15 '13 14:01 cfalzone

Working now on mssql... no errors in log

DeanGonzalez avatar Jan 15 '13 17:01 DeanGonzalez