Published by Niels on 23 Feb 2010

Forcing a Yii application to authenticate

I wanted my Yii based application to force users to authenticate. After studying the forums, the manuals and searching the web the solution came to me just as I was about to go to bed. It is dead simple: just make sure that the only action a default user can perform is actionLogin(). See the code below on how to accomplish this:

<?php
 
class SiteController extends Controller
{
    /**
     * @return array action filters
     */
    public function filters()
    {
        return array(
            'accessControl', // perform access control for CRUD operations
        );
    }
 
    /**
     * Specifies the access control rules.
     * This method is used by the 'accessControl' filter.
     * @return array access control rules
     */
    public function accessRules()
    {
        return array(
            array('allow',  // allow all users to perform 'login'
                'actions'=>array('login'),
                'users'=>array('*'),
            ),
            array('allow', // allow authenticated user to perform any action
                'users'=>array('@'),
            ),
            array('deny',  // deny all users
                'users'=>array('*'),
            ),
        );
    }
 
    // The rest of the SiteController implementation
 
}
 
?>

I am not sure if this is the best possible solution, but since it is simple and elegant I am inclined to think it is.

Published by Niels on 07 Feb 2010

Just blogging again

A lot has happened the last couple of years. This has kept me busy and did not leave me with much desire to keep this blog up to data. And just when you think I will blog tomorrow, tomorrow has gone. And when tomorrow has gone, two years are gone.

But while I was enjoying a presentation on Identi.ca at FOSDEM I all of a sudden had the idea that now would be a good time to start again. So I joined Identi.ca and added this entry to this site. Expect more in the very near future. Being on-line feels like fun again.

Published by Niels on 01 Feb 2008

Mmmmm, nerd test…

I am not sure if this is good or bad. I just did the Nerd Test and got the following result:
I am nerdier than 94% of all people. Are you a nerd? Click here to find out!

Should I be proud or crawl back in the basement?

Let’s see with the second test offered at that site:

NerdTests.com says I'm a Cool Nerd King.  What are you?  Click here!

Ok, back into the basement, I have to dust of some comic books…

Published by Niels on 14 Nov 2007

Color schemes, Color schemes, Color schemes…

As a passionate and seasoned user of the best editor in the world I always look around for ways to improve the editing experience. One way to improve that is by selecting a good color scheme. The ViM website offer a ton of color schemes but no way to sample them other then look at the user ratings, install them and then judge for yourself. And even then the color schemes on the ViM site are not all schemes that are available.

Fortunately someone wrote a page where, as far as I know, all color schemes are shown and downloadable. Even my two favorite ones: here and here. The only minor annoyance is the fact that the color schemes are not all alphabetically ordered.

I know, I know, old news, but I still like to use this web site as my own long term memory…

Published by Niels on 14 Oct 2007

Aikido exam images added

Just added some more pictures from the aikido exams in Amersfoort on 6 October. You can find them here.

If you really like them as I do, just contact my lovely wife.

Published by Niels on 12 Oct 2007

Comment spam (a big 132 to spammers)

Ever since I changed my CMS to WordPress, the ability to comment option on my postings has been switched on. Of course I do not want all kinds of spam on my weblog, so at first I made sure that only comments from people I approved would be allowed on this weblog. This caused me to have to disapprove a lot of comments a day, so I installed the Akismet plugin for WordPress. That caught a lot of spam comments automatically, but the plugin retains the comments for 15 days before finally deleting them. So after 15 days I had +/- 900 comment spams in my database, waiting to be deleted once they are 15 days old.

Since I am a cheapskate (read: I don not want to pay for more storage than necessary). I was wondering how to reduce the number of comment spams that Akismet had to catch. So I installed a CAPTCHA plugin called reCAPTCHA. It has the nice side effect that it not only generates good captchas remotely and with disabled (i.e. blind) people in mind, it also is used to help in digitizing old books. The words that you type in are scrambled images from a book that needs to be digitized. What a wonderful project!

Lets see if this keeps down the amount of comment spam. And if you are wondering what the ‘132′ means in the title: just show this number in binary using your fingers :).

Update 11:36:

First it seemed that the CAPTCHA plugin did not prevent comments from being processed by Akismet. After some Googling I found that the Akismet plugin had to be switched off. But reCAPTCHA is seems to be easily defeated as I already have 6 comments waiting to be moderated. So for now I will switch Akismet on again, saving me some time moderating.

Published by Niels on 06 Oct 2007

Aikido!

Incredible but true, I passed my aikido shodan test today! It feels really good as most people are convinced I am more of a jiu-jitsu type than an aikido type.

The exam itself went really well. I wasn’t nervous at all and completely focused and relaxed. Although you wouldn’t think so if you looked at my face on the image below. Perhaps that is way people have the perception that I am more of a jiu-jitsu guy.

As far as I know I only made two mistakes: moving a bit too fast on kote-gaeshi and mixing up kata-otoshi and kata-ha-otoshi when asked to perform kata-otoshi.

Next time I hope to take part as Rick’s uke. He unfortunately did not pass his nidan test. But knowing his dedication I am sure that he will put on a great show in March.

A big THANKS! for Willem and Raymond for helping me pass this test and for Rick for still allowing to have a party at his house.

Image of shodan exam

Published by Niels on 25 Jul 2007

The finald leads

Are the heaviest. Or so they say in Dutch. It means that the last task you have to do is the hardest.

This is just a message to let you know that the internal links should now all point to the correct places within this web site and that this website is now fully functional.

Published by Niels on 24 Jul 2007

Looking better and better (2)…

The overview of the archives in the sidebar was a bit too verbose to my taste. So in a natural reflex (stupid software engineers) I studied how to write my own archive list creation function. Luckily I thought of searching for a Wordpress plugin that filled my needs. Thanks again!

Published by Niels on 24 Jul 2007

Looking better and better

The default Wordpress theme is so….

DEFAULT!

So I went searching on the web for nice themes and this was the one I really liked. Only a few minor tweaks were necessary thus far.

Check out the creator’s site, he has lots more where this came from. Thanks!

Next »