factor/extra/http/server/auth/auth.factor

27 lines
680 B
Factor
Raw Normal View History

2008-03-11 04:39:09 -04:00
! Copyright (c) 2008 Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
2008-03-11 17:03:22 -04:00
USING: http.server.sessions accessors
2008-03-17 05:31:13 -04:00
http.server.auth.providers assocs namespaces kernel ;
2008-03-11 04:39:09 -04:00
IN: http.server.auth
SYMBOL: logged-in-user
2008-03-17 05:31:13 -04:00
SYMBOL: user-profile-changed?
GENERIC: init-user-profile ( responder -- )
M: object init-user-profile drop ;
2008-03-11 04:39:09 -04:00
: uid ( -- string ) logged-in-user sget username>> ;
2008-03-17 05:31:13 -04:00
: profile ( -- assoc ) logged-in-user sget profile>> ;
: uget ( key -- value )
profile at ;
: uset ( value key -- )
profile set-at user-profile-changed? on ;
: uchange ( quot key -- )
profile swap change-at
user-profile-changed? on ; inline