Author: ajaquith
Date: Thu May 22 21:22:32 2008
New Revision: 659416
URL: http://svn.apache.org/viewvc?rev=659416&view=rev
Log:
Checked in three new features for UserProfile and the UserDatabase classes.
First, profiles can now store arbitrary Serializable objects via a new method
in UserProfile, getAttributes, that returns a Map<Serializable,Serializable>
that can be directly manipulated. Arbitrary attributes such as user preferences
can be added to the profile and be guaranteed to be persisted on save. Second,
the UserProfile now has two methods setLockExpiry(Date)/getLockExpiry that
allow callers to disable user profiles. These are NOT enforced in
AuthenticationManager yet. Third, user profile now have a 'uid' field that
stores a long value for uniquely identifying users. Existing profiles without
UIDs are automatically upgraded when they are loaded by a findBy___() method.
The default XML/JDBC UserDatabase implementations have been enhanced to support
all of these new features. If you have custom UserDatabase implementations, you
should take a look at the new code.
Modified:
incubator/jspwiki/trunk/etc/db/hsql/userdb-setup.ddl
Modified: incubator/jspwiki/trunk/etc/db/hsql/userdb-setup.ddl
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/db/hsql/userdb-setup.ddl?rev=659416&r1=659415&r2=659416&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/db/hsql/userdb-setup.ddl (original)
+++ incubator/jspwiki/trunk/etc/db/hsql/userdb-setup.ddl Thu May 22 21:22:32
2008
@@ -5,6 +5,7 @@
drop user @jdbc.user.id@;
create table @jspwiki.userdatabase.table@ (
+ @jspwiki.userdatabase.uid@ bigint,
@jspwiki.userdatabase.email@ varchar(100),
@jspwiki.userdatabase.fullName@ varchar(100),
@jspwiki.userdatabase.loginName@ varchar(100) not null,
@@ -12,7 +13,9 @@
@jspwiki.userdatabase.wikiName@ varchar(100),
@jspwiki.userdatabase.created@ timestamp,
@jspwiki.userdatabase.modified@ timestamp,
- constraint @jspwiki.userdatabase.table@ primary key
(@jspwiki.userdatabase.loginName@)
+ @jspwiki.userdatabase.lockExpiry@ timestamp,
+ @jspwiki.userdatabase.attributes@ longvarchar,
+ constraint @jspwiki.userdatabase.table@ primary key
(@jspwiki.userdatabase.uid@)
);
create table @jspwiki.userdatabase.roleTable@ (
@@ -44,26 +47,32 @@
grant select, insert, update, delete on @jspwiki.groupdatabase.membertable@ to
@jdbc.user.id@;
insert into @jspwiki.userdatabase.table@ (
+ @jspwiki.userdatabase.uid@,
@jspwiki.userdatabase.email@,
@jspwiki.userdatabase.fullName@,
@jspwiki.userdatabase.loginName@,
@jspwiki.userdatabase.password@,
- @jspwiki.userdatabase.wikiName@
+ @jspwiki.userdatabase.wikiName@,
+ @jspwiki.userdatabase.attributes@
) values (
+ '-7739839977499061014',
'[EMAIL PROTECTED]',
'Janne Jalkanen',
'janne',
'{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==',
- 'JanneJalkanen'
+ 'JanneJalkanen',
+ 'attribute1=some random value\nattribute2=another value'
);
insert into @jspwiki.userdatabase.table@ (
+ @jspwiki.userdatabase.uid@,
@jspwiki.userdatabase.email@,
@jspwiki.userdatabase.fullName@,
@jspwiki.userdatabase.loginName@,
@jspwiki.userdatabase.password@,
@jspwiki.userdatabase.wikiName@
) values (
+ '-6852820166199419346',
'[EMAIL PROTECTED]',
'Administrator',
'admin',