1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: db db.tuples db.types accessors
4 furnace.auth.providers kernel continuations
6 IN: furnace.auth.providers.db
10 { "username" "USERNAME" { VARCHAR 256 } +user-assigned-id+ }
11 { "realname" "REALNAME" { VARCHAR 256 } }
12 { "password" "PASSWORD" BLOB +not-null+ }
13 { "salt" "SALT" INTEGER +not-null+ }
14 { "email" "EMAIL" { VARCHAR 256 } }
15 { "ticket" "TICKET" { VARCHAR 256 } }
16 { "capabilities" "CAPABILITIES" FACTOR-BLOB }
17 { "profile" "PROFILE" FACTOR-BLOB }
18 { "deleted" "DELETED" INTEGER +not-null+ }
21 : init-users-table ( -- ) user ensure-table ;
23 SINGLETON: users-in-db
25 M: users-in-db get-user
26 drop <user> select-tuple ;
28 M: users-in-db new-user
32 over username>> >>username
40 M: users-in-db update-user