The documentation for nimble is not really all that good, however, the plugin is amazing. I feel lazy switching to spring security, so for the moment I'm sticking with nimble/shiro.
So I needed to create some default permissions, groups and roles in my application and it was taking me some time to figure out how to do this. What I had to do was to edit grails-app/conf/NimbleBootStrap.groovy and add them like this:
def adminOfficerRole = roleService.createRole('ADMIN_OFFICER','Administrative Offficers', false)
def basicMgmtGroup = groupService.createGroup('BASIC_MGMT','Group that does basic management',false)
roleService.addGroupMemeber(basicMgmtGroup,adminOfficerRole)
LevelPermission perm = new LevelPermission()
perm.populate('controller1,controller2','*',null,null,null,null)
perm.managed=false
permissionService.createPermission(perm,basicMgmtGroup)
//Add a user to a role
roleService.addMember(UserBase.findByUsername('username'),adminOfficerRole)
In our controllers we can now check for permissions as follows:
if(SecurityUtils.getSubject().isPermitted("controller:action")){
//DO SOMETHING HERE
}
Whew! Okay, now I shouldn't forget. :D
Thursday, 7 July 2011
Radioactivo 98.5
While I was studying in Mexico from 1996 to 2002, my favourite radio station was Radioactivo 98.5 . It was closed down in 2002, but it left its mark in the Mexican Radiostation landscape. So when I found a link where I could listen to it once more I was delighted. It is more like a retrospective radiostation. Anyways, here is the link:
Wednesday, 6 July 2011
Intro
Okay, this is my first attempt at blogging. Have so many things on my mind, decided that maybe this is a good way to track and record them.
Subscribe to:
Posts (Atom)