pihentagy asked:

User management

Hi!

In a site it is a common pattern to handle users, and roles associated to some users.

Is there some helper function to manage them? (which generates user and role tables, and so on…)

(2 attempts)

Kashia answered:

There's a tool called "nitro-auth" which is installable using gem.

$ gem install nitro-auth

This will install nitro-auth 0.2.0.

require 'rubygems'
require 'nitro'
require 'og'
require 'nitro/auth'

# ... Og setup etc

include Nitro
include Auth

Server.map = {
  '/' => YourController,
  '/auth' => AuthController
}

Nitro.run

Sadly it's not useable "as-is". Since it's already a bit older, a few small corrections have to be made.

I didn't really use it yet, but it seems to integrate nicely even into newer Nitro versions (I think it was written around Nitro 0.21). Since I need a good auth system myself, I will probably look harder into it sometime, manveru is on that case as well.

Rating: 3

Fabian answered:

I don't know if there's something finished. User handling is in most examples though (e.g. flare).

A basic model for user handling could be:

class User
  property :nick,      String, :unique => true
  property :password,  String
  property :role,      Fixnum
  property :email,     String, :unique => true
end

Of course you might want to encode the password and you could also have seperate model for roles.

Rating: 2