Very basic user management

Added an user list page and a form to create new users. All users can
create other users.
This commit is contained in:
Emmanuel BENOîT 2012-02-06 00:09:21 +01:00
parent b6b5cd982e
commit 071577168a
7 changed files with 225 additions and 29 deletions

View file

@ -0,0 +1,21 @@
--
-- Create a new user
--
CREATE OR REPLACE FUNCTION users_add( _email TEXT , _salt TEXT , _iters INT , _hash TEXT )
RETURNS INT
LANGUAGE PLPGSQL
STRICT VOLATILE SECURITY INVOKER
AS $users_add$
BEGIN
INSERT INTO users ( user_email , user_salt , user_iterations , user_hash )
VALUES ( _email , _salt , _iters , _hash );
RETURN 0;
EXCEPTION
WHEN unique_violation THEN
RETURN 1;
END;
$users_add$;
REVOKE EXECUTE ON FUNCTION users_add( TEXT , TEXT , INT , TEXT ) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION users_add( TEXT , TEXT , INT , TEXT) TO :webapp_user;