Monday, February 24, 2014

Grails and Spring Security Core Plugin: Controller Annotation Fun

i'm on Grails 2.3.5.  Couldnt seem to get the controller's create view to appear.  Consistently showed me the "Not authorized to view..." message.

So, assuming you are using "Annotation" for your securityConfigType in your Config.groovy, you might be able to get your setup to reveal the create view, too.

Perusing the same Config.groovy, peer closer.

if you're upgrading security, you might have some items missing like, css, you need to add it or you're page will block.
i added the create views and the kicker, /**.  i saw it referenced in the logging and its addition seemed to gain access to the create view.

grails.plugin.springsecurity.controllerAnnotations.staticRules =
[
'/':                              ['permitAll'],
'/index':                         ['permitAll'],
'/index.gsp':                     ['permitAll'],
'/create':      ['permitAll'],
"/create.gsp":  ['permitAll'],
'/**/js/**':                      ['permitAll'],
'/**/css/**':                     ['permitAll'],
'/**/images/**':                  ['permitAll'],
'/**/favicon.ico':                ['permitAll'],
'/login/**':                      ['permitAll'],
'/logout/**':                     ['permitAll'],
'/**':                            ['permitAll']
]

woof!


Sunday, February 23, 2014

Git Bit? Untracking generated files that you foolishly tracked

cd to the directory where the tracked files exist.  add this magic: git update-index --assume-unchanged $(git ls-files)

It all goes ignored.

woof!

Friday, February 7, 2014

Switching Windows in Windows

Had a request to ping pong between two applications running in windows.

So, when the user clicks a button from application A, it fires this executable (see below).  This program looks to see if the other application B is running, if so, it switches to application B and puts it in the foreground of the user's session.  if application B is not running, it start application B.  For this post, i'm only showing the process from A to B.  You can simply reuse this code to switch from B to A.

Microsoft's task manager gives you some insight into what needs to be done.  An application running in windows is called a "process".

From a windows desktop application, the program interrogates all processes for a particular process name, e.g. "IntuifaceComposer".

If the process exists, the program obtains a window handle and puts the application in the UI's foreground by using a function in dll import, user32.dll, SetForegroundWindow().

Otherwise, if a new application is needed, the program calls the Start method of Process and passes the file location of the application.