Help setting permissions
-
I am able to retrieve a set of points based on devicename = MU2 and when I try to apply the permissions I get this error... Mango XHR request failed, status=error, error=Server Error, url=/rest/v1/data-points/bulk-apply-read-permissions?deviceName=match=MU2
Checking the log it complains about value too long for the column. Can someone tell me what the issue is? I am trying to add "polycorp" to the read permissions column of this data set "user312,Quser,superadmin".
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; Value too long for column "READPERMISSION VARCHAR_IGNORECASE(255) SELECTIVITY 2": "CAST('MU2user207,MU2user208,MU2user209,MU2user203,MU2user302,MU2user204,MU2user303,MU2user205,MU2user206,polycorp,superadmin,MU2... (266)"; SQL statement: UPDATE "PUBLIC"."DATAPOINTS" SET "ID"=? ,"READPERMISSION"=? ,"SETPERMISSION"=? WHERE "ID"=? [22001-196]; nested exception is org.h2.jdbc.JdbcSQLException: Value too long for column "READPERMISSION VARCHAR_IGNORECASE(255) SELECTIVITY 2": "CAST('MU2user207,MU2user208,MU2user209,MU2user203,MU2user302,MU2user204,MU2user303,MU2user205,MU2user206,polycorp,superadmin,MU2... (266)"; SQL statement: UPDATE "PUBLIC"."DATAPOINTS" SET "ID"=? ,"READPERMISSION"=? ,"SETPERMISSION"=? WHERE "ID"=? [22001-196] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:246) ~[spring-jdbc-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1402) ~[spring-jdbc-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:620) ~[spring-jdbc-5.0.10.RELEASE.jar:5.0.10.RELEASE] at com.serotonin.m2m2.db.dao.DataPointDao.bulkUpdatePermissions(DataPointDao.java:1421) ~[mango-3.5.6.jar:?] at com.serotonin.m2m2.web.mvc.rest.v1.DataPointRestController.bulkApplyReadPermissions(DataPointRestController.java:876) ~[?:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171]
-
It looks to me like you are adding a permission to a point that already has a long list of permissions. The maximum size of the permissions columns for data points is 255 characters.
You say:
I am trying to add "polycorp" to the read permissions column of this data set "user312,Quser,superadmin".
But the stacktrace shows this:
Value too long for column "READPERMISSION VARCHAR_IGNORECASE(255) SELECTIVITY 2": "CAST('MU2user207,MU2user208,MU2user209,MU2user203,MU2user302,MU2user204,MU2user303,MU2user205,MU2user206,polycorp,superadmin,MU2... (266)";
Does that point actually have that many permissions on it already?
-
OK Thank-you,
I will clear these and rebuild it per this 255char constraint