Saturday, April 18, 2015

Enable/Disable Windows Network Interface

Disable
netsh interface set interface name="Local Area Connection" admin=disabled

Enable
netsh interface set interface name="Local Area Connection" admin=Enabled

Reset
netsh interface set interface name="Local Area Connection" admin=disabled & netsh interface set interface name="Local Area Connection" admin=Enabled

Wednesday, April 8, 2015

Spring Roo 1.2.4, Spring Security 3.1

Customizing voters:

public class MyRightVoter extends RoleVoter implements AccessDecisionVoter
{
    public int vote( Authentication authentication, Object object,
Collection attributes )
    {}
}

Defining proper access decision manager and adding customized voter to it:
* To override http decision manager beans must be added to applicationContext-security.xml and for method based in controller must be added in webmvc-config.xml and add to it.











Adding new decision manager for method and http handling:

* aspectj mode is used when want to add security to our aspects like roo generated aspect (new aspect should be defined to annotate security to methods), this mode should be defined in applicationContext-security.xml, this global definition doesn't require to reference acess-decision-manage, as the main one that is in use, defined in webmvc-config.xml


* It is possible to customize authentication to return customized authority of users by implementing getAuthorities() method.

 * Don't forget to add the following item to spring/webmvc-config.xml to use annotation in spring controllers

Tuesday, April 7, 2015

Get Relative Path of Application Context

def s = ctx.grailsLinkGenerator

s.contextPath

s.serverBaseURL


The service is in the following package :
org.codehaus.groovy.grails.web.mapping.LinkGenerator

Use Services in Grails Shell/Console

def svc = ctx.getBean('serviceName')

def svc = ctx.serviceName