Felipe Cypriano

You're about to read

Customizing SpringSecurity to Protect Each Button of a Page Using Grails Acegi Plugin

I’m very happy with grails acegi plugin, aka Spring Security Plugin, but on my newest project I needed a finner grained way to do control access than using simple urls filters and roles.

I wanted a way to control which button, link, action of the current page the user can access. If the user has only read access to a page than the page is shown but edit action isn’t, because of this requirement using only roles to grant access isn’t enough and could easily became a mess if I create one role per action. Use urls filters won’t work because most urls are generated by ZK framework and hence are non predictable.

The solution is fully based on SpringSecurity capabilities and should work on every project that uses it independent of plugins or frameworks that I use.

Solving Grails/GORM Data Truncation Error on Blob Column Using Java

Today GORM was in a bad mood and refuses to insert a text in a blob (clob) column. If a set a non null value in the attribute which was mapped to a blob field I end up with this strange error:

Caused by: java.sql.DataTruncation: Data truncation

Data truncation for a blob column makes no sense since blobs are made to handle large amount of data, as far as I know the limit is your storage space. What I needed was an improved version of the Setting class that cames with settings plugin, I wanted to store large texts in some settings, larger the 100 characters which is the current limit, so I create a new attribute to store large texts, this new attribute is a blob in the dabase. Here is the new grails domain class that I created: