TinyAuth Beta 2 - Now actually usable

Alias on 2007-09-28T08:04:11

After another series of incremental releases, I've now largely moved up from testing "TinyAuth' (my yet-to-be-properly-named ultra-minimalist SVN repository manager) only in test scripts to testing it on a real server with a real .htpasswd file using a real browser (although not for a real service yet).

If you are interested, feel free to point a browser, indeed ANYTHING that calls itself a "browser", at http://svn.ali.as/cgi-bin/tinyauth.

You can use the username "adamk@cpan.org" and password "foo" to login and add an account for yourself (and promote yourself to admin if you want).

I've also added some basic installation instructions for anyone that is interested in tinkering with an installation of their own.

Please note there's still more polishing, bug fixing and general getting-ready to do before the final release, so expect a few potential nigglies.


Incorrect Password

Ovid on 2007-09-28T08:36:01

Did someone change your password? I can't login :)

Re:Incorrect Password

Shlomi Fish on 2007-09-28T11:01:18

I can confirm this. I tried to login now and was not able to, either.

Re:Incorrect Password

Alias on 2007-09-28T11:53:16

I've reset the password to "foo", I must have changed it during testing.

Go nuts.

Re:Incorrect Password

Shlomi Fish on 2007-09-29T16:23:15

Thanks. I was able to login to TinyAuth, create an account, receive the password by mail and promote myself to admin.

However, I cannot seem to be able to commit anything to the repository:

shlomi:~/progs/perl/cpan/Archive-Zip/trunk/Archive-Zip$ svn commit -F svn-commit.tmp
Authentication realm: <http://svn.ali.as:80> The Open Repository
Password for 'shlomi':
Authentication realm: <http://svn.ali.as:80> The Open Repository
Username: shlomif@cpan.org
Password for 'shlomif@cpan.org':
Authentication realm: <http://svn.ali.as:80> The Open Repository
Username: shlomif@cpan.org
Password for 'shlomif@cpan.org':
svn: Commit failed (details follow):
svn: MKACTIVITY of '/cpan/!svn/act/01c8280d-61bf-4791-a907-da1dc407188a': authorization failed (http://svn.ali.as)

Re:Incorrect Password

Alias on 2007-09-30T00:30:45

That is correct.

As I mentioned, the application is just for testing purposes atm, it isn't controlling the actual repository yet.

I'll do that some time down the track, just before release.

Re:Incorrect Password

Shlomi Fish on 2007-09-30T08:55:12

I see. Thanks.

In any case I'd like to commence work on Archive::Zip, and it would be helpful if I had a commit access to the repository.

Re:Incorrect Password

Alias on 2007-10-01T21:18:34

I plan to start dog-fooding properly in the next day or so.

Re:Incorrect Password

Shlomi Fish on 2007-10-02T09:28:31

I plan to start dog-fooding properly in the next day or so.

Thanks!

run method is ugly!

Ovid on 2007-09-28T08:44:25

Your &run method if/elsif/else chain is very difficult to read. Switching to a dispatch table makes it much easier to understand.

my %method_for = (
    o => 'action_logout',
    f => 'view_forgot',
    r => 'action_forgot',
    c => 'view_change',
    p => 'action_change',
    n => 'view_new',
    a => 'action_new',
    l => 'view_list',
    m => 'view_promote',
    b => 'action_promote',
    d => 'view_delete',
    e => 'action_delete'
);
sub run {
    my $self = shift;
    if ( my $method = $method_for{ $self->action } ) {
        return $self->$method;
    } elsif ( $self->action eq 'error' ) {
        return 1;
    } else {
        return $self->view_index;
    }
}

You could simplify that even more, but I figured that was a good start.

Re:run method is ugly!

Alias on 2007-09-28T11:35:22

I'm not sure I'd call that simpler, possibly more elegant though

Re:run method is ugly!

Ovid on 2007-09-28T11:43:29

It's easier to see which action maps to which method and makes it less likely to have bugs in the future as adding a new action is trivial. You just add a new entry to the hash and don't have to worry about the code.

Re:run method is ugly!

sigzero on 2007-09-28T12:00:16

I find that both elegant and easier to read. I haven' used dispatch tables much but time to go read about them again. : )

Re:run method is ugly!

Alias on 2007-09-29T02:05:45

The "but time to go read about them again" is the main reason I don't want to use them... I'm trying to keep stuff as utterly boring and minimalist as possible.

But you are right the if/else chain is VISUALLY hard to read, so I might do something to fix that instead of moving to dispatch table.

Re:run method is ugly!

Aristotle on 2007-09-29T03:09:16

Technically that’s not even a dispatch table (since it does not map from strings to coderefs). I don’t know why people “need to read about them” either – I came up with the concept independently long before I knew it had a name. Seems obvious to me, and I don’t think I am a genius… what do I know.

And actually, I don’t know why Ovid rewrote the code the way he did, because it’s easy to make it even simpler:

sub run {
    my $self = shift;

    return 1 if $self->action eq 'error';

    my $method = $method_for{ $self->action } || 'view_index';
    return $self->$method;
}

I think this pushes the readability difference beyond the point where the improvement is arguable.